Class: XeroCLI::Commands::Receive

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

Constant Summary collapse

TRANSACTION_TYPE =
'RECEIVE'.freeze

Instance Method Summary collapse

Methods inherited from Base

#format_date, #money_to_cents, #read_guid, #xero_api

Constructor Details

#initialize(options) ⇒ Receive

Returns a new instance of Receive.



4
5
6
7
8
9
10
# File 'lib/xero_cli/commands/receive.rb', line 4

def initialize(options)
  @receive = options.receive.to_f
  @to = options.to
  @from = options.from
  @on = options.on
  @as = options.as
end

Instance Method Details

#performObject



12
13
14
15
16
17
18
# File 'lib/xero_cli/commands/receive.rb', line 12

def perform
  check_exceptions
   = as.nil? ? nil : XeroCLI::AccountsStorage.(as)
  transaction_attributes = XeroCLI::Templates::Transaction.attributes(receive, TRANSACTION_TYPE, from, to, , on)
  create_transaction(transaction_attributes)
  write_to_terminal
end