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.
14675 14676 14677 14678 14679 14680 14681 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14675 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::LineItemForm) ? x : ::Io::Flow::V0::Models::LineItemForm.new(x)) } end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
14673 14674 14675 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14673 def id @id end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
14673 14674 14675 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14673 def items @items end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
14687 14688 14689 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14687 def copy(incoming={}) DigitalDelivery.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
14691 14692 14693 14694 14695 14696 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14691 def subtype_to_hash { :id => id, :items => items.map { |o| o.to_hash } } end |
#to_json ⇒ Object
14683 14684 14685 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14683 def to_json JSON.dump(to_hash) end |