class AmazonPurchasesLedger::Shipment

Public Class Methods

new(items_csv:, order_csv_row:) click to toggle source
# File lib/amazon_purchases_ledger/shipment.rb, line 6
def initialize(items_csv:, order_csv_row:)
  @items_csv = items_csv
  @order_csv_row = order_csv_row
end

Public Instance Methods

items() click to toggle source
# File lib/amazon_purchases_ledger/shipment.rb, line 24
def items
  AmazonPurchasesLedger::Item::Factory.new(carrier_tracking: @order_csv_row[:carrier_name__tracking_number],
                                           items_csv: @items_csv)
    .items
end
output_text() click to toggle source
# File lib/amazon_purchases_ledger/shipment.rb, line 11
def output_text
  [
    "Shipment: #{@order_csv_row[:carrier_name__tracking_number]}",
    items.map { |item| item.output_text },
    '----------------------'
  ].join("\n")
end
total_charged() click to toggle source
# File lib/amazon_purchases_ledger/shipment.rb, line 19
def total_charged
  return nil unless @order_csv_row[:total_charged]
  @order_csv_row[:total_charged].gsub('$', '').to_d
end