Class: Portage::Ucp::Order
- Inherits:
-
Data
- Object
- Data
- Portage::Ucp::Order
- Defined in:
- lib/portage/ucp/value_objects.rb
Overview
schemas/shopping/order.json — requires ucp/id/checkout_id/permalink_url/
line_items/fulfillment/currency/totals. adjustments is optional —
omitted from the wire payload when empty.
Instance Attribute Summary collapse
-
#adjustments ⇒ Object
readonly
Returns the value of attribute adjustments.
-
#checkout_id ⇒ Object
readonly
Returns the value of attribute checkout_id.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#fulfillment ⇒ Object
readonly
Returns the value of attribute fulfillment.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#line_items ⇒ Object
readonly
Returns the value of attribute line_items.
-
#permalink_url ⇒ Object
readonly
Returns the value of attribute permalink_url.
-
#totals ⇒ Object
readonly
Returns the value of attribute totals.
Instance Method Summary collapse
-
#initialize(id:, checkout_id:, permalink_url:, line_items:, fulfillment:, currency:, totals:, adjustments: []) ⇒ Order
constructor
A new instance of Order.
- #to_wire_h ⇒ Object
Constructor Details
#initialize(id:, checkout_id:, permalink_url:, line_items:, fulfillment:, currency:, totals:, adjustments: []) ⇒ Order
Returns a new instance of Order.
170 171 172 173 |
# File 'lib/portage/ucp/value_objects.rb', line 170 def initialize(id:, checkout_id:, permalink_url:, line_items:, fulfillment:, currency:, totals:, adjustments: []) super end |
Instance Attribute Details
#adjustments ⇒ Object (readonly)
Returns the value of attribute adjustments
168 169 170 |
# File 'lib/portage/ucp/value_objects.rb', line 168 def adjustments @adjustments end |
#checkout_id ⇒ Object (readonly)
Returns the value of attribute checkout_id
168 169 170 |
# File 'lib/portage/ucp/value_objects.rb', line 168 def checkout_id @checkout_id end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency
168 169 170 |
# File 'lib/portage/ucp/value_objects.rb', line 168 def currency @currency end |
#fulfillment ⇒ Object (readonly)
Returns the value of attribute fulfillment
168 169 170 |
# File 'lib/portage/ucp/value_objects.rb', line 168 def fulfillment @fulfillment end |
#id ⇒ Object (readonly)
Returns the value of attribute id
168 169 170 |
# File 'lib/portage/ucp/value_objects.rb', line 168 def id @id end |
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items
168 169 170 |
# File 'lib/portage/ucp/value_objects.rb', line 168 def line_items @line_items end |
#permalink_url ⇒ Object (readonly)
Returns the value of attribute permalink_url
168 169 170 |
# File 'lib/portage/ucp/value_objects.rb', line 168 def permalink_url @permalink_url end |
#totals ⇒ Object (readonly)
Returns the value of attribute totals
168 169 170 |
# File 'lib/portage/ucp/value_objects.rb', line 168 def totals @totals end |
Instance Method Details
#to_wire_h ⇒ Object
175 176 177 178 179 180 181 |
# File 'lib/portage/ucp/value_objects.rb', line 175 def to_wire_h h = { "id" => id, "checkout_id" => checkout_id, "permalink_url" => permalink_url, "line_items" => line_items.map(&:to_wire_h), "fulfillment" => fulfillment.to_wire_h, "currency" => currency, "totals" => totals.map(&:to_wire_h) } h["adjustments"] = adjustments.map(&:to_wire_h) unless adjustments.empty? h end |