class Io::Flow::V0::Models::ShopifyCartAddSingleForm

Attributes

id[R]
properties[R]
quantity[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 67152
def initialize(incoming={})
  super(:discriminator => ShopifyCartAddForm::Types::SHOPIFY_CART_ADD_SINGLE_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :quantity], 'ShopifyCartAddSingleForm')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), Integer)
  @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer)
  @properties = (x = opts.delete(:properties); x.nil? ? nil : HttpClient::Preconditions.assert_class('properties', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('properties', d[1], String); h })
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 67165
def copy(incoming={})
  ShopifyCartAddSingleForm.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 67169
def subtype_to_hash
  {
    :id => id,
    :quantity => quantity,
    :properties => properties.nil? ? nil : properties
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 67161
def to_json
  JSON.dump(to_hash)
end