Class: Afterpay::PaymentEvent
- Inherits:
-
Object
- Object
- Afterpay::PaymentEvent
- Defined in:
- lib/afterpay/payment_event.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#created ⇒ Object
Returns the value of attribute created.
-
#expires ⇒ Object
Returns the value of attribute expires.
-
#id ⇒ Object
Returns the value of attribute id.
-
#payment_event_merchant_reference ⇒ Object
Returns the value of attribute payment_event_merchant_reference.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
-
.from_response(response) ⇒ Object
Builds PaymentEvent from response.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ PaymentEvent
constructor
A new instance of PaymentEvent.
Constructor Details
#initialize(attributes = {}) ⇒ PaymentEvent
Returns a new instance of PaymentEvent.
7 8 9 10 11 12 13 14 |
# File 'lib/afterpay/payment_event.rb', line 7 def initialize(attributes = {}) @id = attributes[:id] || "" @created = attributes[:created] || "" @expires = attributes[:expires] || "" @type = attributes[:type] || "" @amount = attributes[:amount] || Money.from_amount(0) @payment_event_merchant_reference = attributes[:payment_event_merchant_reference] || "" end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
5 6 7 |
# File 'lib/afterpay/payment_event.rb', line 5 def amount @amount end |
#created ⇒ Object
Returns the value of attribute created.
5 6 7 |
# File 'lib/afterpay/payment_event.rb', line 5 def created @created end |
#expires ⇒ Object
Returns the value of attribute expires.
5 6 7 |
# File 'lib/afterpay/payment_event.rb', line 5 def expires @expires end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/afterpay/payment_event.rb', line 5 def id @id end |
#payment_event_merchant_reference ⇒ Object
Returns the value of attribute payment_event_merchant_reference.
5 6 7 |
# File 'lib/afterpay/payment_event.rb', line 5 def payment_event_merchant_reference @payment_event_merchant_reference end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/afterpay/payment_event.rb', line 5 def type @type end |
Class Method Details
.from_response(response) ⇒ Object
Builds PaymentEvent from response
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/afterpay/payment_event.rb', line 17 def self.from_response(response) return nil if response.nil? new( id: response[:id], created: response[:created], expires: response[:expires], type: response[:type], amount: Utils::Money.from_response(response[:amount]), payment_event_merchant_reference: response[:paymentEventMerchantReference] ) end |