class Io::Flow::V0::Models::DigitalDelivery

Represents a collection of items that are digitally available and do not require a physical shipment

Attributes

id[R]
items[R]
key[R]
prices[R]
total[R]

Public Class Methods

new(incoming={}) click to toggle source
Calls superclass method Io::Flow::V0::Models::Delivery::new
# File lib/flow_commerce/flow_api_v0_client.rb, line 39714
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

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 39729
def copy(incoming={})
  DigitalDelivery.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 39733
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() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 39725
def to_json
  JSON.dump(to_hash)
end