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.



37279
37280
37281
37282
37283
37284
37285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37279

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



37277
37278
37279
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37277

def attributes
  @attributes
end

#currencyObject (readonly)

Returns the value of attribute currency.



37277
37278
37279
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37277

def currency
  @currency
end

#priceObject (readonly)

Returns the value of attribute price.



37277
37278
37279
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37277

def price
  @price
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37291
37292
37293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37291

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

#to_hashObject



37295
37296
37297
37298
37299
37300
37301
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37295

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

#to_jsonObject



37287
37288
37289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37287

def to_json
  JSON.dump(to_hash)
end