Class: XeroCLI::Commands::Balance

Inherits:
Base
  • Object
show all
Defined in:
lib/xero_cli/commands/balance.rb

Instance Method Summary collapse

Methods inherited from Base

#format_date, #money_to_cents, #read_guid, #xero_api

Constructor Details

#initialize(options) ⇒ Balance

Returns a new instance of Balance.



2
3
4
# File 'lib/xero_cli/commands/balance.rb', line 2

def initialize(options)
  @bank_name = options.balance
end

Instance Method Details

#performObject



6
7
8
9
10
11
12
# File 'lib/xero_cli/commands/balance.rb', line 6

def perform
  balance = get_balance(bank_name)
  result = JSON.parse(balance)['balance']
  ap "#{bank_name}: #{result}"
rescue StandardError
  ap "Couldn't find bank with name '#{bank_name}'"
end