Class: Io::Flow::V0::Models::DigitalDelivery
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a collection of items that are digitally available and do not require a physical shipment
Instance Attribute Summary collapse
-
#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.
-
#prices ⇒ Object
readonly
Returns the value of attribute prices.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Attributes inherited from Delivery
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DigitalDelivery
constructor
A new instance of DigitalDelivery.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Delivery
Constructor Details
#initialize(incoming = {}) ⇒ DigitalDelivery
Returns a new instance of DigitalDelivery.
30257 30258 30259 30260 30261 30262 30263 30264 30265 30266 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30257 def initialize(incoming={}) super(:discriminator => Delivery::Types::DIGITAL_DELIVERY) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :items], 'DigitalDelivery') @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)) @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)) } @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))) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
30255 30256 30257 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30255 def id @id end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
30255 30256 30257 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30255 def items @items end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
30255 30256 30257 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30255 def key @key end |
#prices ⇒ Object (readonly)
Returns the value of attribute prices.
30255 30256 30257 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30255 def prices @prices end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
30255 30256 30257 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30255 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
30272 30273 30274 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30272 def copy(incoming={}) DigitalDelivery.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
30276 30277 30278 30279 30280 30281 30282 30283 30284 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30276 def subtype_to_hash { :id => id, :key => key, :items => items.map { |o| o.to_hash }, :prices => prices.nil? ? nil : prices.map { |o| o.to_hash }, :total => total.nil? ? nil : total.to_hash } end |
#to_json ⇒ Object
30268 30269 30270 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30268 def to_json JSON.dump(to_hash) end |