Class: Io::Flow::V0::Models::CatalogItemDocument
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#experiences ⇒ Object
readonly
Returns the value of attribute experiences.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Attributes inherited from Document
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CatalogItemDocument
constructor
A new instance of CatalogItemDocument.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Document
Constructor Details
#initialize(incoming = {}) ⇒ CatalogItemDocument
Returns a new instance of CatalogItemDocument.
25497 25498 25499 25500 25501 25502 25503 25504 25505 25506 25507 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25497 def initialize(incoming={}) super(:discriminator => Document::Types::CATALOG_ITEM_DOCUMENT) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:number, :name, :categories, :experiences, :attributes, :images], 'CatalogItemDocument') @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @categories = HttpClient::Preconditions.assert_class('categories', opts.delete(:categories), Array).map { |v| HttpClient::Preconditions.assert_class('categories', v, String) } @experiences = HttpClient::Preconditions.assert_class('experiences', opts.delete(:experiences), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ExperienceSummary) ? x : ::Io::Flow::V0::Models::ExperienceSummary.new(x)) } @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h } @images = (x = opts.delete(:images); x.is_a?(::Io::Flow::V0::Models::CatalogItemDocumentImages) ? x : ::Io::Flow::V0::Models::CatalogItemDocumentImages.new(x)) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
25495 25496 25497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25495 def attributes @attributes end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
25495 25496 25497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25495 def categories @categories end |
#experiences ⇒ Object (readonly)
Returns the value of attribute experiences.
25495 25496 25497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25495 def experiences @experiences end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
25495 25496 25497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25495 def images @images end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
25495 25496 25497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25495 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
25495 25496 25497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25495 def number @number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
25513 25514 25515 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25513 def copy(incoming={}) CatalogItemDocument.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
25517 25518 25519 25520 25521 25522 25523 25524 25525 25526 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25517 def subtype_to_hash { :number => number, :name => name, :categories => categories, :experiences => experiences.map { |o| o.to_hash }, :attributes => attributes, :images => images.to_hash } end |
#to_json ⇒ Object
25509 25510 25511 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25509 def to_json JSON.dump(to_hash) end |