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.
-
#goods_supply ⇒ Object
readonly
Returns the value of attribute goods_supply.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#prices ⇒ Object
readonly
Returns the value of attribute prices.
-
#special_services ⇒ Object
readonly
Returns the value of attribute special_services.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
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.
43317 43318 43319 43320 43321 43322 43323 43324 43325 43326 43327 43328 43329 43330 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43317 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) @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, 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::DeliveryItem) ? x : ::Io::Flow::V0::Models::DeliveryItem.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)) } @special_services = (x = opts.delete(:special_services); x.nil? ? nil : HttpClient::Preconditions.assert_class('special_services', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PhysicalDeliverySpecialSerivce) ? x : ::Io::Flow::V0::Models::PhysicalDeliverySpecialSerivce.apply(x)) }) @prices = (x = opts.delete(:prices); x.nil? ? nil : HttpClient::Preconditions.assert_class('prices', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x)) }) @total = (x = opts.delete(:total); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LocalizedTotal) ? x : ::Io::Flow::V0::Models::LocalizedTotal.new(x))) @goods_supply = (x = opts.delete(:goods_supply); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::GoodsSupply) ? x : ::Io::Flow::V0::Models::GoodsSupply.apply(x))) end |
Instance Attribute Details
#center ⇒ Object (readonly)
Returns the value of attribute center.
43315 43316 43317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43315 def center @center end |
#goods_supply ⇒ Object (readonly)
Returns the value of attribute goods_supply.
43315 43316 43317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43315 def goods_supply @goods_supply end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
43315 43316 43317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43315 def id @id end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
43315 43316 43317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43315 def items @items end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
43315 43316 43317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43315 def key @key end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
43315 43316 43317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43315 def end |
#prices ⇒ Object (readonly)
Returns the value of attribute prices.
43315 43316 43317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43315 def prices @prices end |
#special_services ⇒ Object (readonly)
Returns the value of attribute special_services.
43315 43316 43317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43315 def special_services @special_services end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
43315 43316 43317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43315 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
43336 43337 43338 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43336 def copy(incoming={}) PhysicalDelivery.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
43340 43341 43342 43343 43344 43345 43346 43347 43348 43349 43350 43351 43352 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43340 def subtype_to_hash { :id => id, :key => key, :center => center.nil? ? nil : center.to_hash, :items => items.map { |o| o.to_hash }, :options => .map { |o| o.to_hash }, :special_services => special_services.nil? ? nil : special_services.map { |o| o.value }, :prices => prices.nil? ? nil : prices.map { |o| o.to_hash }, :total => total.nil? ? nil : total.to_hash, :goods_supply => goods_supply.nil? ? nil : goods_supply.value } end |
#to_json ⇒ Object
43332 43333 43334 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43332 def to_json JSON.dump(to_hash) end |