Class: Io::Flow::V0::Models::OrganizationTransactionUpserted

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

Returns a new instance of OrganizationTransactionUpserted.



55726
55727
55728
55729
55730
55731
55732
55733
55734
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55726

def initialize(incoming={})
  super(:discriminator => Event::Types::ORGANIZATION_TRANSACTION_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :transaction], 'OrganizationTransactionUpserted')
  @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)
  @transaction = (x = opts.delete(:transaction); x.is_a?(::Io::Flow::V0::Models::Transaction) ? x : ::Io::Flow::V0::Models::Transaction.new(x))
end

Instance Attribute Details

#event_idObject (readonly)

Returns the value of attribute event_id.



55724
55725
55726
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55724

def event_id
  @event_id
end

#organizationObject (readonly)

Returns the value of attribute organization.



55724
55725
55726
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55724

def organization
  @organization
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



55724
55725
55726
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55724

def timestamp
  @timestamp
end

#transactionObject (readonly)

Returns the value of attribute transaction.



55724
55725
55726
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55724

def transaction
  @transaction
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



55740
55741
55742
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55740

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

#subtype_to_hashObject



55744
55745
55746
55747
55748
55749
55750
55751
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55744

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :transaction => transaction.to_hash
  }
end

#to_jsonObject



55736
55737
55738
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55736

def to_json
  JSON.dump(to_hash)
end