Class: Io::Flow::V0::Models::ShopifyCartChangeForm

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

Overview

Must provide either line or id. If you provide both, they must match

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ShopifyCartChangeForm

Returns a new instance of ShopifyCartChangeForm.



47969
47970
47971
47972
47973
47974
47975
47976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47969

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:quantity], 'ShopifyCartChangeForm')
  @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer)
  @line = (x = opts.delete(:line); x.nil? ? nil : HttpClient::Preconditions.assert_class('line', x, Integer))
  @id = (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, 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

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



47967
47968
47969
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47967

def id
  @id
end

#lineObject (readonly)

Returns the value of attribute line.



47967
47968
47969
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47967

def line
  @line
end

#propertiesObject (readonly)

Returns the value of attribute properties.



47967
47968
47969
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47967

def properties
  @properties
end

#quantityObject (readonly)

Returns the value of attribute quantity.



47967
47968
47969
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47967

def quantity
  @quantity
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47982
47983
47984
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47982

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

#to_hashObject



47986
47987
47988
47989
47990
47991
47992
47993
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47986

def to_hash
  {
    :quantity => quantity,
    :line => line,
    :id => id,
    :properties => properties.nil? ? nil : properties
  }
end

#to_jsonObject



47978
47979
47980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47978

def to_json
  JSON.dump(to_hash)
end