Class: Io::Flow::V0::Models::LocalItemPricing
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::LocalItemPricing
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Localized item pricing information
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ LocalItemPricing
constructor
A new instance of LocalItemPricing.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ LocalItemPricing
Returns a new instance of LocalItemPricing.
23073 23074 23075 23076 23077 23078 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23073 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price, :attributes], 'LocalItemPricing') @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::LocalizedItemPrice) ? x : ::Io::Flow::V0::Models::LocalizedItemPrice.new(x)) @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = (x = d[1]; x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x)); h } end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
23071 23072 23073 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23071 def attributes @attributes end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
23071 23072 23073 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23071 def price @price end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
23084 23085 23086 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23084 def copy(incoming={}) LocalItemPricing.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
23088 23089 23090 23091 23092 23093 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23088 def to_hash { :price => price.to_hash, :attributes => attributes.inject({}) { |hash, o| hash[o[0]] = o[1].nil? ? nil : o[1].to_hash; hash } } end |
#to_json ⇒ Object
23080 23081 23082 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23080 def to_json JSON.dump(to_hash) end |