Class: Io::Flow::V0::Models::TestUpserted

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

Returns a new instance of TestUpserted.



70382
70383
70384
70385
70386
70387
70388
70389
70390
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70382

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

Instance Attribute Details

#event_idObject (readonly)

Returns the value of attribute event_id.



70380
70381
70382
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70380

def event_id
  @event_id
end

#organizationObject (readonly)

Returns the value of attribute organization.



70380
70381
70382
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70380

def organization
  @organization
end

#testObject (readonly)

Returns the value of attribute test.



70380
70381
70382
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70380

def test
  @test
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



70380
70381
70382
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70380

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



70396
70397
70398
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70396

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

#subtype_to_hashObject



70400
70401
70402
70403
70404
70405
70406
70407
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70400

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

#to_jsonObject



70392
70393
70394
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70392

def to_json
  JSON.dump(to_hash)
end