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.



67123
67124
67125
67126
67127
67128
67129
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67123

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)) }
  @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



67121
67122
67123
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67121

def attributes
  @attributes
end

#itemsObject (readonly)

Returns the value of attribute items.



67121
67122
67123
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67121

def items
  @items
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



67135
67136
67137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67135

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

#subtype_to_hashObject



67139
67140
67141
67142
67143
67144
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67139

def subtype_to_hash
  {
    :items => items.map { |o| o.to_hash },
    :attributes => attributes.nil? ? nil : attributes
  }
end

#to_jsonObject



67131
67132
67133
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67131

def to_json
  JSON.dump(to_hash)
end