Class: Io::Flow::V0::Models::PhysicalDelivery
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a collection of items, the available delivery option tier for that collection of items, and metadata about those options
Instance Attribute Summary collapse
-
#center ⇒ Object
readonly
Returns the value of attribute center.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes inherited from Delivery
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PhysicalDelivery
constructor
A new instance of PhysicalDelivery.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Delivery
Constructor Details
#initialize(incoming = {}) ⇒ PhysicalDelivery
Returns a new instance of PhysicalDelivery.
22594 22595 22596 22597 22598 22599 22600 22601 22602 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22594 def initialize(incoming={}) super(:discriminator => Delivery::Types::PHYSICAL_DELIVERY) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :items, :options], 'PhysicalDelivery') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @center = (x = opts.delete(:center); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CenterSummary) ? x : ::Io::Flow::V0::Models::CenterSummary.new(x))) @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LineItemForm) ? x : ::Io::Flow::V0::Models::LineItemForm.new(x)) } = HttpClient::Preconditions.assert_class('options', opts.delete(:options), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::DeliveryOption) ? x : ::Io::Flow::V0::Models::DeliveryOption.new(x)) } end |
Instance Attribute Details
#center ⇒ Object (readonly)
Returns the value of attribute center.
22592 22593 22594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22592 def center @center end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
22592 22593 22594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22592 def id @id end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
22592 22593 22594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22592 def items @items end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
22592 22593 22594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22592 def end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
22608 22609 22610 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22608 def copy(incoming={}) PhysicalDelivery.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
22612 22613 22614 22615 22616 22617 22618 22619 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22612 def subtype_to_hash { :id => id, :center => center.nil? ? nil : center.to_hash, :items => items.map { |o| o.to_hash }, :options => .map { |o| o.to_hash } } end |
#to_json ⇒ Object
22604 22605 22606 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22604 def to_json JSON.dump(to_hash) end |