class XeroCLI::Commands
Attributes
options[R]
xero[R]
Public Class Methods
new(options, xero)
click to toggle source
# File lib/xero_cli/commands.rb, line 5 def initialize(options, xero) @options = options @xero = xero end
Public Instance Methods
perform()
click to toggle source
# File lib/xero_cli/commands.rb, line 10 def perform help if options.help set_guid if options.set_guid show_guid if options.show_guid show_accounts if options.show_accounts get_guid if options.get_guid spend if options.spend receive if options.receive transfer if options.transfer balance if options.balance default end
Private Instance Methods
balance()
click to toggle source
# File lib/xero_cli/commands.rb, line 72 def balance balance = XeroCLI::Commands::Balance.new(options) balance.perform exit 1 end
default()
click to toggle source
# File lib/xero_cli/commands.rb, line 78 def default puts 'Please use "xero -h" or "xero --help" to check the available commands.' end
get_account(type)
click to toggle source
# File lib/xero_cli/commands.rb, line 86 def get_account(type) xero_api.accounts(type) end
get_guid()
click to toggle source
# File lib/xero_cli/commands.rb, line 41 def get_guid system('start', XeroCLI::Constants::XERO_CONNECTOR_ADDRESS) system('xdg-open', XeroCLI::Constants::XERO_CONNECTOR_ADDRESS) system('open', XeroCLI::Constants::XERO_CONNECTOR_ADDRESS) exit 1 end
help()
click to toggle source
# File lib/xero_cli/commands.rb, line 25 def help puts xero exit 1 end
read_guid()
click to toggle source
# File lib/xero_cli/commands.rb, line 82 def read_guid @read_guid ||= XeroCLI::Credentials.read_guid end
receive()
click to toggle source
# File lib/xero_cli/commands.rb, line 60 def receive receive = XeroCLI::Commands::Receive.new(options) receive.perform exit 1 end
set_guid()
click to toggle source
# File lib/xero_cli/commands.rb, line 30 def set_guid XeroCLI::Credentials.set(options.set_guid) ap "Xero GUID set to #{read_guid}" exit 1 end
show_accounts()
click to toggle source
# File lib/xero_cli/commands.rb, line 48 def show_accounts accounts = XeroCLI::Commands::Accounts.new(options) accounts.perform exit 1 end
show_guid()
click to toggle source
# File lib/xero_cli/commands.rb, line 36 def show_guid ap read_guid exit 1 end
spend()
click to toggle source
# File lib/xero_cli/commands.rb, line 54 def spend spend = XeroCLI::Commands::Spend.new(options) spend.perform exit 1 end
transfer()
click to toggle source
# File lib/xero_cli/commands.rb, line 66 def transfer transfer = XeroCLI::Commands::Transfer.new(options) transfer.perform exit 1 end