Class: Io::Flow::V0::Models::AttributeUpserted

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 = {}) ⇒ AttributeUpserted

Returns a new instance of AttributeUpserted.



23185
23186
23187
23188
23189
23190
23191
23192
23193
23194
23195
23196
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23185

def initialize(incoming={})
  super(:discriminator => Event::Types::ATTRIBUTE_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :key, :label, :type], 'AttributeUpserted')
  @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)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @label = HttpClient::Preconditions.assert_class('label', opts.delete(:label), String)
  @intent = (x = opts.delete(:intent); x.nil? ? nil : HttpClient::Preconditions.assert_class('intent', x, String))
  @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String)
end

Instance Attribute Details

#event_idObject (readonly)

Returns the value of attribute event_id.



23183
23184
23185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23183

def event_id
  @event_id
end

#intentObject (readonly)

Returns the value of attribute intent.



23183
23184
23185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23183

def intent
  @intent
end

#keyObject (readonly)

Returns the value of attribute key.



23183
23184
23185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23183

def key
  @key
end

#labelObject (readonly)

Returns the value of attribute label.



23183
23184
23185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23183

def label
  @label
end

#organizationObject (readonly)

Returns the value of attribute organization.



23183
23184
23185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23183

def organization
  @organization
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



23183
23184
23185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23183

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



23183
23184
23185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23183

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23202
23203
23204
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23202

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

#subtype_to_hashObject



23206
23207
23208
23209
23210
23211
23212
23213
23214
23215
23216
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23206

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :key => key,
    :label => label,
    :intent => intent,
    :type => type
  }
end

#to_jsonObject



23198
23199
23200
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23198

def to_json
  JSON.dump(to_hash)
end