Class: Klarna::Checkout::Order
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/klarna/checkout/order.rb
Instance Attribute Summary collapse
-
#completed_at ⇒ Object
Returns the value of attribute completed_at.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_modified_at ⇒ Object
Returns the value of attribute last_modified_at.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#purchase_country ⇒ Object
Returns the value of attribute purchase_country.
-
#purchase_currency ⇒ Object
Returns the value of attribute purchase_currency.
-
#reference ⇒ Object
Returns the value of attribute reference.
-
#reservation ⇒ Object
Returns the value of attribute reservation.
-
#started_at ⇒ Object
Returns the value of attribute started_at.
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Resource
defaults=, #initialize, #json_sanitize, #to_json
Methods included from HasOne
Methods included from HasMany
Constructor Details
This class inherits a constructor from Klarna::Checkout::Resource
Instance Attribute Details
#completed_at ⇒ Object
Returns the value of attribute completed_at.
9 10 11 |
# File 'lib/klarna/checkout/order.rb', line 9 def completed_at @completed_at end |
#created_at ⇒ Object
Returns the value of attribute created_at.
9 10 11 |
# File 'lib/klarna/checkout/order.rb', line 9 def created_at @created_at end |
#expires_at ⇒ Object
Returns the value of attribute expires_at.
9 10 11 |
# File 'lib/klarna/checkout/order.rb', line 9 def expires_at @expires_at end |
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/klarna/checkout/order.rb', line 9 def id @id end |
#last_modified_at ⇒ Object
Returns the value of attribute last_modified_at.
9 10 11 |
# File 'lib/klarna/checkout/order.rb', line 9 def last_modified_at @last_modified_at end |
#locale ⇒ Object
Returns the value of attribute locale.
9 10 11 |
# File 'lib/klarna/checkout/order.rb', line 9 def locale @locale end |
#purchase_country ⇒ Object
Returns the value of attribute purchase_country.
13 14 15 |
# File 'lib/klarna/checkout/order.rb', line 13 def purchase_country @purchase_country end |
#purchase_currency ⇒ Object
Returns the value of attribute purchase_currency.
13 14 15 |
# File 'lib/klarna/checkout/order.rb', line 13 def purchase_currency @purchase_currency end |
#reference ⇒ Object
Returns the value of attribute reference.
9 10 11 |
# File 'lib/klarna/checkout/order.rb', line 9 def reference @reference end |
#reservation ⇒ Object
Returns the value of attribute reservation.
9 10 11 |
# File 'lib/klarna/checkout/order.rb', line 9 def reservation @reservation end |
#started_at ⇒ Object
Returns the value of attribute started_at.
9 10 11 |
# File 'lib/klarna/checkout/order.rb', line 9 def started_at @started_at end |
#status ⇒ Object
Returns the value of attribute status.
9 10 11 |
# File 'lib/klarna/checkout/order.rb', line 9 def status @status end |
Class Method Details
.defaults ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/klarna/checkout/order.rb', line 57 def defaults defaults = super defaults = { purchase_country: Klarna::Checkout.default_country, purchase_currency: Klarna::Checkout.default_currency, merchant: { id: Klarna::Checkout.merchant_id } }.deep_merge(defaults) defaults end |
Instance Method Details
#as_json ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/klarna/checkout/order.rb', line 27 def as_json json = json_sanitize({ :merchant_reference => (@merchant_reference && @merchant_reference.as_json), :purchase_country => @purchase_country, :purchase_currency => @purchase_currency, :locale => @locale, :cart => @cart.as_json, :gui => (@gui && @gui.as_json), :merchant => @merchant.as_json }) if id || json[:gui].nil? json.delete(:gui) end if id json.delete(:merchant) end json end |