Class: Portage::Ucp::FulfillmentMethod
- Inherits:
-
Data
- Object
- Data
- Portage::Ucp::FulfillmentMethod
- Defined in:
- lib/portage/ucp/value_objects.rb
Overview
schemas/shopping/types/fulfillment_method.json — shipping or pickup for
a subset of line items. The agent submits type/line_item_ids on
create; the merchant fills in destinations/groups for the agent to
then select selected_destination_id and each group's
selected_option_id on update.
Instance Attribute Summary collapse
-
#destinations ⇒ Object
readonly
Returns the value of attribute destinations.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#line_item_ids ⇒ Object
readonly
Returns the value of attribute line_item_ids.
-
#selected_destination_id ⇒ Object
readonly
Returns the value of attribute selected_destination_id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(id:, type:, line_item_ids:, destinations: [], selected_destination_id: nil, groups: []) ⇒ FulfillmentMethod
constructor
A new instance of FulfillmentMethod.
- #to_wire_h ⇒ Object
Constructor Details
#initialize(id:, type:, line_item_ids:, destinations: [], selected_destination_id: nil, groups: []) ⇒ FulfillmentMethod
Returns a new instance of FulfillmentMethod.
310 311 312 |
# File 'lib/portage/ucp/value_objects.rb', line 310 def initialize(id:, type:, line_item_ids:, destinations: [], selected_destination_id: nil, groups: []) super end |
Instance Attribute Details
#destinations ⇒ Object (readonly)
Returns the value of attribute destinations
309 310 311 |
# File 'lib/portage/ucp/value_objects.rb', line 309 def destinations @destinations end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups
309 310 311 |
# File 'lib/portage/ucp/value_objects.rb', line 309 def groups @groups end |
#id ⇒ Object (readonly)
Returns the value of attribute id
309 310 311 |
# File 'lib/portage/ucp/value_objects.rb', line 309 def id @id end |
#line_item_ids ⇒ Object (readonly)
Returns the value of attribute line_item_ids
309 310 311 |
# File 'lib/portage/ucp/value_objects.rb', line 309 def line_item_ids @line_item_ids end |
#selected_destination_id ⇒ Object (readonly)
Returns the value of attribute selected_destination_id
309 310 311 |
# File 'lib/portage/ucp/value_objects.rb', line 309 def selected_destination_id @selected_destination_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type
309 310 311 |
# File 'lib/portage/ucp/value_objects.rb', line 309 def type @type end |
Instance Method Details
#to_wire_h ⇒ Object
314 315 316 317 318 319 320 |
# File 'lib/portage/ucp/value_objects.rb', line 314 def to_wire_h h = { "id" => id, "type" => type, "line_item_ids" => line_item_ids } h["destinations"] = destinations.map(&:to_wire_h) unless destinations.empty? h["selected_destination_id"] = selected_destination_id if selected_destination_id h["groups"] = groups.map(&:to_wire_h) unless groups.empty? h end |