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

#to_hash

Constructor Details

#initialize(incoming = {}) ⇒ AttributeUpserted

Returns a new instance of AttributeUpserted.



9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9639

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_id ⇒ Object (readonly)

Returns the value of attribute event_id.



9637
9638
9639
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9637

def event_id
  @event_id
end

#intent ⇒ Object (readonly)

Returns the value of attribute intent.



9637
9638
9639
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9637

def intent
  @intent
end

#key ⇒ Object (readonly)

Returns the value of attribute key.



9637
9638
9639
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9637

def key
  @key
end

#label ⇒ Object (readonly)

Returns the value of attribute label.



9637
9638
9639
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9637

def label
  @label
end

#organization ⇒ Object (readonly)

Returns the value of attribute organization.



9637
9638
9639
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9637

def organization
  @organization
end

#timestamp ⇒ Object (readonly)

Returns the value of attribute timestamp.



9637
9638
9639
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9637

def timestamp
  @timestamp
end

#type ⇒ Object (readonly)

Returns the value of attribute type.



9637
9638
9639
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9637

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



9656
9657
9658
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9656

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

#subtype_to_hash ⇒ Object



9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9660

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

#to_json ⇒ Object



9652
9653
9654
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9652

def to_json
  JSON.dump(to_hash)
end