Class: Square::Connect::Payment
- Defined in:
- lib/square/connect/payment.rb
Instance Attribute Summary collapse
-
#additive_tax ⇒ Object
Returns the value of attribute additive_tax.
-
#additive_tax_money ⇒ Object
Returns the value of attribute additive_tax_money.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#creator ⇒ Object
Returns the value of attribute creator.
-
#description ⇒ Object
Returns the value of attribute description.
-
#device ⇒ Object
Returns the value of attribute device.
-
#discount_money ⇒ Object
Returns the value of attribute discount_money.
-
#inclusive_tax ⇒ Object
Returns the value of attribute inclusive_tax.
-
#inclusive_tax_money ⇒ Object
Returns the value of attribute inclusive_tax_money.
-
#itemizations ⇒ Object
Returns the value of attribute itemizations.
-
#merchant ⇒ Object
Returns the value of attribute merchant.
-
#net_total_money ⇒ Object
Returns the value of attribute net_total_money.
-
#processing_fee_money ⇒ Object
Returns the value of attribute processing_fee_money.
-
#refunded_money ⇒ Object
Returns the value of attribute refunded_money.
-
#refunds ⇒ Object
Returns the value of attribute refunds.
-
#tax_money ⇒ Object
Returns the value of attribute tax_money.
-
#tender ⇒ Object
Returns the value of attribute tender.
-
#tip_money ⇒ Object
Returns the value of attribute tip_money.
-
#total_collected_money ⇒ Object
Returns the value of attribute total_collected_money.
Attributes inherited from Node
#access_token, #endpoint, #identifier
Instance Method Summary collapse
-
#initialize(*args) ⇒ Payment
constructor
A new instance of Payment.
Methods inherited from Node
Constructor Details
#initialize(*args) ⇒ Payment
Returns a new instance of Payment.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/square/connect/payment.rb', line 26 def initialize(*args) super do |attributes| self.merchant = if attributes[:merchant_id] Merchant.new attributes[:merchant_id], access_token else Merchant.me access_token end self.creator = if attributes[:creator_id] Merchant.new attributes[:creator_id], access_token end self.created_at = if attributes[:created_at] Time.parse attributes[:created_at] end self.description = attributes[:description] self.device = if attributes[:device] Device.new attributes[:device] end [ :inclusive_tax_money, :additive_tax_money, :tax_money, :tip_money, :discount_money, :total_collected_money, :processing_fee_money, :net_total_money, :refunded_money ].each do |money_key| if attributes[money_key] self.send "#{money_key}=", Money.new(attributes[money_key]) end end [ :inclusive_tax, :additive_tax ].each do |tax_key| taxes = Array(attributes[tax_key]).collect do |tax_attributes| Tax.new tax_attributes end self.send "#{tax_key}=", taxes end self.tender = Array(attributes[:tender]).collect do |tender_attributes| Tender.new tender_attributes end self.refunds = Array(attributes[:refunds]).collect do |refund_attributes| Refund.new refund_attributes end self.itemizations = Array(attributes[:itemizations]).collect do |itemization_attributes| Itemization.new itemization_attributes end self.endpoint = endpoint_for merchant.identifier, :payments, identifier end end |
Instance Attribute Details
#additive_tax ⇒ Object
Returns the value of attribute additive_tax.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def additive_tax @additive_tax end |
#additive_tax_money ⇒ Object
Returns the value of attribute additive_tax_money.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def additive_tax_money @additive_tax_money end |
#created_at ⇒ Object
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def created_at @created_at end |
#creator ⇒ Object
Returns the value of attribute creator.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def creator @creator end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def description @description end |
#device ⇒ Object
Returns the value of attribute device.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def device @device end |
#discount_money ⇒ Object
Returns the value of attribute discount_money.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def discount_money @discount_money end |
#inclusive_tax ⇒ Object
Returns the value of attribute inclusive_tax.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def inclusive_tax @inclusive_tax end |
#inclusive_tax_money ⇒ Object
Returns the value of attribute inclusive_tax_money.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def inclusive_tax_money @inclusive_tax_money end |
#itemizations ⇒ Object
Returns the value of attribute itemizations.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def itemizations @itemizations end |
#merchant ⇒ Object
Returns the value of attribute merchant.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def merchant @merchant end |
#net_total_money ⇒ Object
Returns the value of attribute net_total_money.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def net_total_money @net_total_money end |
#processing_fee_money ⇒ Object
Returns the value of attribute processing_fee_money.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def processing_fee_money @processing_fee_money end |
#refunded_money ⇒ Object
Returns the value of attribute refunded_money.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def refunded_money @refunded_money end |
#refunds ⇒ Object
Returns the value of attribute refunds.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def refunds @refunds end |
#tax_money ⇒ Object
Returns the value of attribute tax_money.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def tax_money @tax_money end |
#tender ⇒ Object
Returns the value of attribute tender.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def tender @tender end |
#tip_money ⇒ Object
Returns the value of attribute tip_money.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def tip_money @tip_money end |
#total_collected_money ⇒ Object
Returns the value of attribute total_collected_money.
4 5 6 |
# File 'lib/square/connect/payment.rb', line 4 def total_collected_money @total_collected_money end |