Skip to content

Commit

Permalink
Introduce executor, change README
Browse files Browse the repository at this point in the history
  • Loading branch information
hjhart committed Dec 1, 2016
1 parent 68c7de3 commit 3ad7091
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ This project should allow a user to export orders successfully from Amazon, and
Output a file to STDOUT:

```
./bin/export_to_ynab amazon_orders_and_shipments.csv amazon_items.csv
./bin/ynab_transactions amazon_orders_and_shipments.csv amazon_items.csv
```

Output a file to a csv file

```
./bin/export_to_ynab amazon_orders_and_shipments.csv amazon_items.csv > amazon_orders.csv
./bin/ynab_transactions amazon_orders_and_shipments.csv amazon_items.csv > amazon_transactions.csv
```

## Motivation
Expand Down Expand Up @@ -43,7 +43,7 @@ Export two different CSVs, with Report Type set to 'Items' and one for 'Orders a
Once they fully export (takes a while) you'll use both of these as inputs for the ruby script.

```
./bin/export_to_ynab amazon_orders_and_shipments.csv amazon_items.csv > amazon_orders.csv
./bin/ynab_transactions amazon_orders_and_shipments.csv amazon_items.csv > amazon_transactions.csv
```

Now, drag navigate to [the new YNAB][the_new_ynab], click on the credit card account that you use on amazon, and the `amazon_orders.csv` file anywhere in the browser. It should then show an import message with all of your transactions.
Expand Down
18 changes: 18 additions & 0 deletions bin/ynab_transactions
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env ruby

require_relative '../config/environment'

items_csv = CSV.parse(File.read(ARGV[0]), headers: true)
shipment_csv = CSV.parse(File.read(ARGV[1]), headers: true)

orders = OrderLoader.new(items_csv: items_csv, shipments_csv: shipment_csv).orders
csv = CSV.generate do |csv|
csv << %w{Date Payee Category Memo Outflow Inflow}
orders.each do |order|
order.transactions.each do |transaction|
csv << transaction
end
end
end

puts csv

0 comments on commit 3ad7091

Please sign in to comment.