class Io::Flow::V0::Models::CatalogItemDocument
Attributes
attributes[R]
categories[R]
experiences[R]
images[R]
name[R]
number[R]
Public Class Methods
new(incoming={})
click to toggle source
Calls superclass method
Io::Flow::V0::Models::Document::new
# File lib/flow_commerce/flow_api_v0_client.rb, line 34039 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
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34055 def copy(incoming={}) CatalogItemDocument.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
subtype_to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34059 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()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34051 def to_json JSON.dump(to_hash) end