Skip to content

Commit

Permalink
Ask for teller account
Browse files Browse the repository at this point in the history
  • Loading branch information
scottrobertson committed Aug 17, 2018
1 parent e7da17b commit a045365
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bin/import
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,19 @@ command :teller do |c|
c.action do |args, options|
raise ArgumentError.new("token is required!") unless options.token
raise ArgumentError.new("ynab_account_id is required!") unless options.ynab_account_id
raise ArgumentError.new("teller_account_id is required!") unless options.teller_account_id

unless options.teller_account_id
accounts = Import::Teller.new(options.token, nil, nil).accounts
accounts.each.with_index do |account, index|
puts "[#{index}] #{account[:institution]} (#{account[:name]})"
end
puts ''

selected_account = ask("Account ID: ", Integer)
options.teller_account_id = accounts[selected_account][:id]
raise ArgumentError.new("Teller account not found") unless options.teller_account_id
end

Import::Teller.new(options.token, options.teller_account_id, options.ynab_account_id).import
end
end
Expand Down

0 comments on commit a045365

Please sign in to comment.