Class: Portage::Ucp::Checkout
- Inherits:
-
Data
- Object
- Data
- Portage::Ucp::Checkout
- Defined in:
- lib/portage/ucp/value_objects.rb
Overview
schemas/shopping/checkout.json — requires ucp/id/line_items/status/
currency/totals/links. status is the real enum (incomplete,
requires_escalation, ready_for_complete, complete_in_progress, completed,
canceled) — not the old ad hoc "pending"/"completed" strings. order is
the schema's optional order_confirmation — set once complete_checkout
actually produces an order, nil otherwise.
Instance Attribute Summary collapse
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#line_items ⇒ Object
readonly
Returns the value of attribute line_items.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#totals ⇒ Object
readonly
Returns the value of attribute totals.
Instance Method Summary collapse
-
#initialize(id:, status:, line_items:, currency:, totals:, links:, order: nil) ⇒ Checkout
constructor
A new instance of Checkout.
- #to_wire_h ⇒ Object
Constructor Details
#initialize(id:, status:, line_items:, currency:, totals:, links:, order: nil) ⇒ Checkout
Returns a new instance of Checkout.
82 |
# File 'lib/portage/ucp/value_objects.rb', line 82 def initialize(id:, status:, line_items:, currency:, totals:, links:, order: nil) = super |
Instance Attribute Details
#currency ⇒ Object (readonly)
Returns the value of attribute currency
81 82 83 |
# File 'lib/portage/ucp/value_objects.rb', line 81 def currency @currency end |
#id ⇒ Object (readonly)
Returns the value of attribute id
81 82 83 |
# File 'lib/portage/ucp/value_objects.rb', line 81 def id @id end |
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items
81 82 83 |
# File 'lib/portage/ucp/value_objects.rb', line 81 def line_items @line_items end |
#links ⇒ Object (readonly)
Returns the value of attribute links
81 82 83 |
# File 'lib/portage/ucp/value_objects.rb', line 81 def links @links end |
#order ⇒ Object (readonly)
Returns the value of attribute order
81 82 83 |
# File 'lib/portage/ucp/value_objects.rb', line 81 def order @order end |
#status ⇒ Object (readonly)
Returns the value of attribute status
81 82 83 |
# File 'lib/portage/ucp/value_objects.rb', line 81 def status @status end |
#totals ⇒ Object (readonly)
Returns the value of attribute totals
81 82 83 |
# File 'lib/portage/ucp/value_objects.rb', line 81 def totals @totals end |
Instance Method Details
#to_wire_h ⇒ Object
84 85 86 87 88 89 |
# File 'lib/portage/ucp/value_objects.rb', line 84 def to_wire_h h = { "id" => id, "status" => status, "line_items" => line_items.map(&:to_wire_h), "currency" => currency, "totals" => totals.map(&:to_wire_h), "links" => links.map(&:to_wire_h) } h["order"] = order.to_wire_h if order h end |