Class: Io::Flow::V0::Models::LocalizedItemUpserted

Inherits:
Event
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from Event

#discriminator

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ LocalizedItemUpserted

Returns a new instance of LocalizedItemUpserted.



19113
19114
19115
19116
19117
19118
19119
19120
19121
19122
19123
19124
19125
19126
19127
19128
19129
19130
19131
19132
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19113

def initialize(incoming={})
  super(:discriminator => Event::Types::LOCALIZED_ITEM_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :number, :catalog, :locale, :name, :currency, :price, :categories, :attributes, :dimensions, :images, :local], 'LocalizedItemUpserted')
  @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)
  @catalog = HttpClient::Preconditions.assert_class('catalog', opts.delete(:catalog), 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) }
  @local = HttpClient::Preconditions.assert_class('local', HttpClient::Helper.to_object(opts.delete(:local)), Hash)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def attributes
  @attributes
end

#catalogObject (readonly)

Returns the value of attribute catalog.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def catalog
  @catalog
end

#categoriesObject (readonly)

Returns the value of attribute categories.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def categories
  @categories
end

#currencyObject (readonly)

Returns the value of attribute currency.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def description
  @description
end

#dimensionsObject (readonly)

Returns the value of attribute dimensions.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def dimensions
  @dimensions
end

#event_idObject (readonly)

Returns the value of attribute event_id.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def event_id
  @event_id
end

#imagesObject (readonly)

Returns the value of attribute images.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def images
  @images
end

#localObject (readonly)

Returns the value of attribute local.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def local
  @local
end

#localeObject (readonly)

Returns the value of attribute locale.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def locale
  @locale
end

#nameObject (readonly)

Returns the value of attribute name.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def number
  @number
end

#organizationObject (readonly)

Returns the value of attribute organization.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def organization
  @organization
end

#priceObject (readonly)

Returns the value of attribute price.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def price
  @price
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



19111
19112
19113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



19138
19139
19140
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19138

def copy(incoming={})
  LocalizedItemUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



19142
19143
19144
19145
19146
19147
19148
19149
19150
19151
19152
19153
19154
19155
19156
19157
19158
19159
19160
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19142

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :number => number,
    :catalog => catalog,
    :locale => locale,
    :name => name,
    :currency => currency,
    :price => price,
    :categories => categories,
    :description => description,
    :attributes => attributes,
    :dimensions => dimensions,
    :images => images,
    :local => local
  }
end

#to_jsonObject



19134
19135
19136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19134

def to_json
  JSON.dump(to_hash)
end