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.
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.
23468 23469 23470 23471 23472 23473 23474 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23468 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) @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)) } end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
23466 23467 23468 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23466 def id @id end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
23466 23467 23468 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23466 def items @items end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
23480 23481 23482 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23480 def copy(incoming={}) DigitalDelivery.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
23484 23485 23486 23487 23488 23489 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23484 def subtype_to_hash { :id => id, :items => items.map { |o| o.to_hash } } end |
#to_json ⇒ Object
23476 23477 23478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23476 def to_json JSON.dump(to_hash) end |