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.
-
#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.
49426 49427 49428 49429 49430 49431 49432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49426 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)) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
49424 49425 49426 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49424 def id @id end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
49424 49425 49426 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49424 def item @item end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
49424 49425 49426 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49424 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
49438 49439 49440 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49438 def copy(incoming={}) SubcatalogItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
49442 49443 49444 49445 49446 49447 49448 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49442 def to_hash { :id => id, :item => item.to_hash, :status => status.value } end |
#to_json ⇒ Object
49434 49435 49436 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49434 def to_json JSON.dump(to_hash) end |