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.



39760
39761
39762
39763
39764
39765
39766
39767
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39760

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.



39758
39759
39760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39758

def id
  @id
end

#lineObject (readonly)

Returns the value of attribute line.



39758
39759
39760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39758

def line
  @line
end

#propertiesObject (readonly)

Returns the value of attribute properties.



39758
39759
39760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39758

def properties
  @properties
end

#quantityObject (readonly)

Returns the value of attribute quantity.



39758
39759
39760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39758

def quantity
  @quantity
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39773
39774
39775
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39773

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

#to_hashObject



39777
39778
39779
39780
39781
39782
39783
39784
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39777

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

#to_jsonObject



39769
39770
39771
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39769

def to_json
  JSON.dump(to_hash)
end