Class: Clearbooks::Payment
Overview
Instance Attribute Summary collapse
-
#accounting_date ⇒ DateTime
readonly
Optional.
-
#amount ⇒ BigDecimal
readonly
Optional.
-
#bank_account ⇒ String
readonly
Optional.
-
#description ⇒ String
readonly
Optional.
-
#entity_id ⇒ Fixnum
readonly
Optional.
-
#invoices ⇒ Array
readonly
Optional.
-
#payment_method ⇒ Fixnum
readonly
Optional.
-
#type ⇒ String
readonly
Optional.
Instance Method Summary collapse
-
#initialize(data) ⇒ Payment
constructor
A new instance of Payment.
-
#to_savon ⇒ Hash
Returns self as Savon readable Hash.
Methods inherited from Base
Constructor Details
#initialize(data) ⇒ Payment
Returns a new instance of Payment.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/clearbooks/model/payment.rb', line 68 def initialize data @accounting_date = parse_date data.savon :accounting_date @type = data.savon :type @description = data.savon :description @amount = BigDecimal.new data.savon :amount @entity_id = data.savon(:entity_id).to_i @payment_method = data.savon(:payment_method).to_i @bank_account = data.savon :bank_account @invoices = data.savon :invoices end |
Instance Attribute Details
#accounting_date ⇒ DateTime (readonly)
Optional. Date the payment was made.
24 25 26 |
# File 'lib/clearbooks/model/payment.rb', line 24 def accounting_date @accounting_date end |
#amount ⇒ BigDecimal (readonly)
Optional. The total amount paid in pounds.
39 40 41 |
# File 'lib/clearbooks/model/payment.rb', line 39 def amount @amount end |
#bank_account ⇒ String (readonly)
Optional. The account code of the bank account being paid into.
54 55 56 |
# File 'lib/clearbooks/model/payment.rb', line 54 def bank_account @bank_account end |
#description ⇒ String (readonly)
Optional.
34 35 36 |
# File 'lib/clearbooks/model/payment.rb', line 34 def description @description end |
#entity_id ⇒ Fixnum (readonly)
Optional. The id of the customer or supplier.
44 45 46 |
# File 'lib/clearbooks/model/payment.rb', line 44 def entity_id @entity_id end |
#invoices ⇒ Array (readonly)
Optional. An array of invoice elements.
59 60 61 |
# File 'lib/clearbooks/model/payment.rb', line 59 def invoices @invoices end |
#payment_method ⇒ Fixnum (readonly)
Optional. The id of the payment method.
49 50 51 |
# File 'lib/clearbooks/model/payment.rb', line 49 def payment_method @payment_method end |
#type ⇒ String (readonly)
Optional. String identifying the type of the payment. Value one of: purchases, sales.
29 30 31 |
# File 'lib/clearbooks/model/payment.rb', line 29 def type @type end |
Instance Method Details
#to_savon ⇒ Hash
Returns self as Savon readable Hash
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/clearbooks/model/payment.rb', line 83 def to_savon { payment: { :@accountingDate => @accounting_date.strftime('%F'), :@type => @type, :@amount => @amount.to_f, :@entityId => @entity_id, :@paymentMethod => @payment_method, :@bankAccount => @bank_account, :description => @description, :invoices => { invoice: savon_invoices } } } end |