Class: Io::Flow::V0::Models::HarmonizedItemUpserted
- 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.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#event_id ⇒ Object
readonly
Returns the value of attribute event_id.
-
#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.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Attributes inherited from Event
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ HarmonizedItemUpserted
constructor
A new instance of HarmonizedItemUpserted.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Event
Constructor Details
#initialize(incoming = {}) ⇒ HarmonizedItemUpserted
Returns a new instance of HarmonizedItemUpserted.
14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14317 def initialize(incoming={}) super(:discriminator => Event::Types::HARMONIZED_ITEM_UPSERTED) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :number, :name, :categories, :attributes], 'HarmonizedItemUpserted') @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) @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) } @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 } @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String)) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
14315 14316 14317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14315 def attributes @attributes end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
14315 14316 14317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14315 def categories @categories end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
14315 14316 14317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14315 def description @description end |
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
14315 14316 14317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14315 def event_id @event_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14315 14316 14317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14315 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
14315 14316 14317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14315 def number @number end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
14315 14316 14317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14315 def organization @organization end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
14315 14316 14317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14315 def @timestamp end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
14335 14336 14337 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14335 def copy(incoming={}) HarmonizedItemUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
14339 14340 14341 14342 14343 14344 14345 14346 14347 14348 14349 14350 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14339 def subtype_to_hash { :event_id => event_id, :timestamp => , :organization => organization, :number => number, :name => name, :categories => categories, :attributes => attributes, :description => description } end |
#to_json ⇒ Object
14331 14332 14333 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14331 def to_json JSON.dump(to_hash) end |