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 experinece.
Instance Attribute Summary collapse
-
#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.
20074 20075 20076 20077 20078 20079 20080 20081 20082 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20074 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)) @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)) end |
Instance Attribute Details
#experience ⇒ Object (readonly)
Returns the value of attribute experience.
20072 20073 20074 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20072 def experience @experience end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
20072 20073 20074 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20072 def id @id end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
20072 20073 20074 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20072 def item @item end |
#pricing ⇒ Object (readonly)
Returns the value of attribute pricing.
20072 20073 20074 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20072 def pricing @pricing end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
20072 20073 20074 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20072 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
20088 20089 20090 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20088 def copy(incoming={}) LocalItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
20092 20093 20094 20095 20096 20097 20098 20099 20100 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20092 def to_hash { :id => id, :experience => experience.to_hash, :item => item.to_hash, :pricing => pricing.to_hash, :status => status.value } end |
#to_json ⇒ Object
20084 20085 20086 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20084 def to_json JSON.dump(to_hash) end |