Class: Portage::Ucp::ReorderResult
- Inherits:
-
Data
- Object
- Data
- Portage::Ucp::ReorderResult
- Defined in:
- lib/portage/ucp/value_objects.rb
Overview
Portage extension — the hydrated Cart plus what got dropped along the way, so a caller can tell the buyer what to expect before checkout rather than silently under-filling the cart.
Instance Attribute Summary collapse
-
#cart ⇒ Object
readonly
Returns the value of attribute cart.
-
#unavailable_items ⇒ Object
readonly
Returns the value of attribute unavailable_items.
Instance Method Summary collapse
-
#initialize(cart:, unavailable_items: []) ⇒ ReorderResult
constructor
A new instance of ReorderResult.
- #to_wire_h ⇒ Object
Constructor Details
#initialize(cart:, unavailable_items: []) ⇒ ReorderResult
Returns a new instance of ReorderResult.
537 |
# File 'lib/portage/ucp/value_objects.rb', line 537 def initialize(cart:, unavailable_items: []) = super |
Instance Attribute Details
#cart ⇒ Object (readonly)
Returns the value of attribute cart
536 537 538 |
# File 'lib/portage/ucp/value_objects.rb', line 536 def cart @cart end |
#unavailable_items ⇒ Object (readonly)
Returns the value of attribute unavailable_items
536 537 538 |
# File 'lib/portage/ucp/value_objects.rb', line 536 def unavailable_items @unavailable_items end |
Instance Method Details
#to_wire_h ⇒ Object
539 540 541 542 543 |
# File 'lib/portage/ucp/value_objects.rb', line 539 def to_wire_h h = { "cart" => cart.to_wire_h } h["unavailable_items"] = unavailable_items.map(&:to_wire_h) unless unavailable_items.empty? h end |