Refine processing command line tool
This commit is contained in:
parent
862e6d9270
commit
fd5246e1d6
19
bin/process
Executable file
19
bin/process
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'bundler/setup'
|
||||||
|
require "planet_express_express"
|
||||||
|
require "stringio"
|
||||||
|
|
||||||
|
data = File.read(ARGV[0])
|
||||||
|
|
||||||
|
shipments = PlanetExpressExpress::ShipmentReader.new(PlanetExpressExpress::PRICE_LIST).read_shipments(data)
|
||||||
|
PlanetExpressExpress::Rules.new(PlanetExpressExpress::PRICE_LIST).apply_rules(shipments)
|
||||||
|
PlanetExpressExpress::DiscountBudget.new(PlanetExpressExpress::DISCOUNT_LIMIT).limit_discounts(shipments)
|
||||||
|
|
||||||
|
output = StringIO.new
|
||||||
|
|
||||||
|
PlanetExpressExpress::Formatter.new(output).format(shipments)
|
||||||
|
|
||||||
|
output.rewind
|
||||||
|
puts output.read
|
@ -1,8 +0,0 @@
|
|||||||
require "bundler/setup"
|
|
||||||
require "planet_express_express"
|
|
||||||
|
|
||||||
data = File.read(ARGV[0])
|
|
||||||
|
|
||||||
shipments = PlanetExpressExpress::ShipmentReader.new(PlanetExpressExpress::PRICE_LIST).read_shipments(data)
|
|
||||||
PlanetExpressExpress::Rules.new(PlanetExpressExpress::PRICE_LIST).apply_rules(shipments)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user