Class: Portage::Ucp::CheckoutFulfillment
- Inherits:
-
Data
- Object
- Data
- Portage::Ucp::CheckoutFulfillment
- Defined in:
- lib/portage/ucp/value_objects.rb
Overview
schemas/shopping/fulfillment.json#/$defs/dev.ucp.shopping.fulfillment —
the Checkout-level container. Named CheckoutFulfillment (not
Fulfillment, already taken by Order's post-purchase expectations/
events container below) to keep the pre-purchase shipping-selection
extension and the post-purchase delivery-tracking extension distinct.
The member is shipping_methods, not the wire key methods — a bare
:methods Data.define member would shadow Kernel#methods.
Instance Attribute Summary collapse
-
#available_methods ⇒ Object
readonly
Returns the value of attribute available_methods.
-
#shipping_methods ⇒ Object
readonly
Returns the value of attribute shipping_methods.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(shipping_methods: [], available_methods: []) ⇒ CheckoutFulfillment
constructor
A new instance of CheckoutFulfillment.
- #to_wire_h ⇒ Object
Constructor Details
#initialize(shipping_methods: [], available_methods: []) ⇒ CheckoutFulfillment
Returns a new instance of CheckoutFulfillment.
345 |
# File 'lib/portage/ucp/value_objects.rb', line 345 def initialize(shipping_methods: [], available_methods: []) = super |
Instance Attribute Details
#available_methods ⇒ Object (readonly)
Returns the value of attribute available_methods
344 345 346 |
# File 'lib/portage/ucp/value_objects.rb', line 344 def available_methods @available_methods end |
#shipping_methods ⇒ Object (readonly)
Returns the value of attribute shipping_methods
344 345 346 |
# File 'lib/portage/ucp/value_objects.rb', line 344 def shipping_methods @shipping_methods end |
Instance Method Details
#empty? ⇒ Boolean
347 |
# File 'lib/portage/ucp/value_objects.rb', line 347 def empty? = shipping_methods.empty? && available_methods.empty? |
#to_wire_h ⇒ Object
349 350 351 352 353 354 |
# File 'lib/portage/ucp/value_objects.rb', line 349 def to_wire_h h = {} h["methods"] = shipping_methods.map(&:to_wire_h) unless shipping_methods.empty? h["available_methods"] = available_methods.map(&:to_wire_h) unless available_methods.empty? h end |