Class: Io::Flow::V0::Models::LocalItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::LocalItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
The Local Item represents all of the data for a given item that is localized to a given experience.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#center ⇒ Object
readonly
Returns the value of attribute center.
-
#experience ⇒ Object
readonly
Returns the value of attribute experience.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#pricing ⇒ Object
readonly
Returns the value of attribute pricing.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ LocalItem
constructor
A new instance of LocalItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ LocalItem
Returns a new instance of LocalItem.
43230 43231 43232 43233 43234 43235 43236 43237 43238 43239 43240 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43230 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :experience, :item, :pricing, :status], 'LocalItem') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::ExperienceSummary) ? x : ::Io::Flow::V0::Models::ExperienceSummary.new(x)) @center = (x = opts.delete(:center); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CenterSummary) ? x : ::Io::Flow::V0::Models::CenterSummary.new(x))) @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::CatalogItemReference) ? x : ::Io::Flow::V0::Models::CatalogItemReference.new(x)) @pricing = (x = opts.delete(:pricing); x.is_a?(::Io::Flow::V0::Models::LocalItemPricing) ? x : ::Io::Flow::V0::Models::LocalItemPricing.new(x)) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x)) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
43228 43229 43230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43228 def attributes @attributes end |
#center ⇒ Object (readonly)
Returns the value of attribute center.
43228 43229 43230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43228 def center @center end |
#experience ⇒ Object (readonly)
Returns the value of attribute experience.
43228 43229 43230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43228 def experience @experience end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
43228 43229 43230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43228 def id @id end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
43228 43229 43230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43228 def item @item end |
#pricing ⇒ Object (readonly)
Returns the value of attribute pricing.
43228 43229 43230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43228 def pricing @pricing end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
43228 43229 43230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43228 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
43246 43247 43248 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43246 def copy(incoming={}) LocalItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
43250 43251 43252 43253 43254 43255 43256 43257 43258 43259 43260 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43250 def to_hash { :id => id, :experience => experience.to_hash, :center => center.nil? ? nil : center.to_hash, :item => item.to_hash, :pricing => pricing.to_hash, :status => status.value, :attributes => attributes.nil? ? nil : attributes } end |
#to_json ⇒ Object
43242 43243 43244 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43242 def to_json JSON.dump(to_hash) end |