Class: Io::Flow::V0::Models::ShopifyCartAddMultipleForm

Inherits:
ShopifyCartAddForm show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from ShopifyCartAddForm

#discriminator

Instance Method Summary collapse

Methods inherited from ShopifyCartAddForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ShopifyCartAddMultipleForm

Returns a new instance of ShopifyCartAddMultipleForm.



37290
37291
37292
37293
37294
37295
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37290

def initialize(incoming={})
  super(:discriminator => ShopifyCartAddForm::Types::SHOPIFY_CART_ADD_MULTIPLE_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:items], 'ShopifyCartAddMultipleForm')
  @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ShopifyCartAddSingleForm) ? x : ::Io::Flow::V0::Models::ShopifyCartAddSingleForm.new(x)) }
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



37288
37289
37290
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37288

def items
  @items
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37301
37302
37303
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37301

def copy(incoming={})
  ShopifyCartAddMultipleForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



37305
37306
37307
37308
37309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37305

def subtype_to_hash
  {
    :items => items.map { |o| o.to_hash }
  }
end

#to_jsonObject



37297
37298
37299
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37297

def to_json
  JSON.dump(to_hash)
end