Class: Io::Flow::V0::Models::ItemPriceUpdatePutForm

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ItemPriceUpdatePutForm

Returns a new instance of ItemPriceUpdatePutForm.



27940
27941
27942
27943
27944
27945
27946
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27940

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:currency, :price], 'ItemPriceUpdatePutForm')
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @price = HttpClient::Preconditions.assert_class('price', HttpClient::Helper.to_big_decimal(opts.delete(:price)), BigDecimal)
  @attributes = HttpClient::Preconditions.assert_class('attributes', (x = opts.delete(:attributes); x.nil? ? {} : 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.



27938
27939
27940
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27938

def attributes
  @attributes
end

#currencyObject (readonly)

Returns the value of attribute currency.



27938
27939
27940
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27938

def currency
  @currency
end

#priceObject (readonly)

Returns the value of attribute price.



27938
27939
27940
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27938

def price
  @price
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



27952
27953
27954
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27952

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

#to_hashObject



27956
27957
27958
27959
27960
27961
27962
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27956

def to_hash
  {
    :currency => currency,
    :price => price,
    :attributes => attributes
  }
end

#to_jsonObject



27948
27949
27950
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27948

def to_json
  JSON.dump(to_hash)
end