Class: Io::Flow::V0::Models::SubcatalogItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::SubcatalogItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents information specific to an item in a given subcatalog
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#item_function ⇒ Object
readonly
Returns the value of attribute item_function.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ SubcatalogItem
constructor
A new instance of SubcatalogItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ SubcatalogItem
Returns a new instance of SubcatalogItem.
31208 31209 31210 31211 31212 31213 31214 31215 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31208 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :item, :status], 'SubcatalogItem') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::Item) ? x : ::Io::Flow::V0::Models::Item.new(x)) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x)) @item_function = (x = opts.delete(:item_function); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ExpandableItemFunction) ? x : ::Io::Flow::V0::Models::ExpandableItemFunction.from_json(x))) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
31206 31207 31208 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31206 def id @id end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
31206 31207 31208 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31206 def item @item end |
#item_function ⇒ Object (readonly)
Returns the value of attribute item_function.
31206 31207 31208 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31206 def item_function @item_function end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
31206 31207 31208 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31206 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
31221 31222 31223 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31221 def copy(incoming={}) SubcatalogItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
31225 31226 31227 31228 31229 31230 31231 31232 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31225 def to_hash { :id => id, :item => item.to_hash, :status => status.value, :item_function => item_function.nil? ? nil : item_function.to_hash } end |
#to_json ⇒ Object
31217 31218 31219 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31217 def to_json JSON.dump(to_hash) end |