Class: Io::Flow::V0::Models::CatalogItemUpserted
- 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.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#dimensions ⇒ Object
readonly
Returns the value of attribute dimensions.
-
#event_id ⇒ Object
readonly
Returns the value of attribute event_id.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Attributes inherited from Event
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CatalogItemUpserted
constructor
A new instance of CatalogItemUpserted.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Event
Constructor Details
#initialize(incoming = {}) ⇒ CatalogItemUpserted
Returns a new instance of CatalogItemUpserted.
34191 34192 34193 34194 34195 34196 34197 34198 34199 34200 34201 34202 34203 34204 34205 34206 34207 34208 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34191 def initialize(incoming={}) super(:discriminator => Event::Types::CATALOG_ITEM_UPSERTED) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :number, :locale, :name, :currency, :price, :categories, :attributes, :dimensions, :images], 'CatalogItemUpserted') @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String) @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime) @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String) @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @locale = HttpClient::Preconditions.assert_class('locale', opts.delete(:locale), String) @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @price = HttpClient::Preconditions.assert_class('price', opts.delete(:price), Numeric) @categories = HttpClient::Preconditions.assert_class('categories', opts.delete(:categories), Array).map { |v| HttpClient::Preconditions.assert_class('categories', v, String) } @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String)) @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 } @dimensions = HttpClient::Preconditions.assert_class('dimensions', HttpClient::Helper.to_object(opts.delete(:dimensions)), Hash) @images = HttpClient::Preconditions.assert_class('images', opts.delete(:images), Array).map { |v| HttpClient::Preconditions.assert_class('images', HttpClient::Helper.to_object(v), Hash) } end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def attributes @attributes end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def categories @categories end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def currency @currency end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def description @description end |
#dimensions ⇒ Object (readonly)
Returns the value of attribute dimensions.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def dimensions @dimensions end |
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def event_id @event_id end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def images @images end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def locale @locale end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def number @number end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def organization @organization end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def price @price end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
34189 34190 34191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34189 def @timestamp end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
34214 34215 34216 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34214 def copy(incoming={}) CatalogItemUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
34218 34219 34220 34221 34222 34223 34224 34225 34226 34227 34228 34229 34230 34231 34232 34233 34234 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34218 def subtype_to_hash { :event_id => event_id, :timestamp => , :organization => organization, :number => number, :locale => locale, :name => name, :currency => currency, :price => price, :categories => categories, :description => description, :attributes => attributes, :dimensions => dimensions, :images => images } end |
#to_json ⇒ Object
34210 34211 34212 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34210 def to_json JSON.dump(to_hash) end |