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.



25624
25625
25626
25627
25628
25629
25630
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25624

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.



25622
25623
25624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25622

def attributes
  @attributes
end

#currencyObject (readonly)

Returns the value of attribute currency.



25622
25623
25624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25622

def currency
  @currency
end

#priceObject (readonly)

Returns the value of attribute price.



25622
25623
25624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25622

def price
  @price
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



25636
25637
25638
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25636

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

#to_hashObject



25640
25641
25642
25643
25644
25645
25646
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25640

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

#to_jsonObject



25632
25633
25634
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25632

def to_json
  JSON.dump(to_hash)
end