Class: Io::Flow::V0::Models::AuthorizationUpserted

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

Returns a new instance of AuthorizationUpserted.



11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11368

def initialize(incoming={})
  super(:discriminator => Event::Types::AUTHORIZATION_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :key, :card, :amount, :currency, :customer, :attributes, :result, :created_at], 'AuthorizationUpserted')
  @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)
  @order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, String))
  @card = HttpClient::Preconditions.assert_class('card', HttpClient::Helper.to_object(opts.delete(:card)), Hash)
  @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @customer = HttpClient::Preconditions.assert_class('customer', HttpClient::Helper.to_object(opts.delete(:customer)), Hash)
  @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 }
  @destination = (x = opts.delete(:destination); x.nil? ? nil : HttpClient::Preconditions.assert_class('destination', HttpClient::Helper.to_object(x), Hash))
  @result = HttpClient::Preconditions.assert_class('result', HttpClient::Helper.to_object(opts.delete(:result)), Hash)
  @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
  @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def amount
  @amount
end

#attributesObject (readonly)

Returns the value of attribute attributes.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def attributes
  @attributes
end

#cardObject (readonly)

Returns the value of attribute card.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def card
  @card
end

#created_atObject (readonly)

Returns the value of attribute created_at.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def currency
  @currency
end

#customerObject (readonly)

Returns the value of attribute customer.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def customer
  @customer
end

#destinationObject (readonly)

Returns the value of attribute destination.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def destination
  @destination
end

#event_idObject (readonly)

Returns the value of attribute event_id.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def event_id
  @event_id
end

#ipObject (readonly)

Returns the value of attribute ip.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def ip
  @ip
end

#keyObject (readonly)

Returns the value of attribute key.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def key
  @key
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def order_number
  @order_number
end

#organizationObject (readonly)

Returns the value of attribute organization.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def organization
  @organization
end

#resultObject (readonly)

Returns the value of attribute result.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def result
  @result
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



11366
11367
11368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11366

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



11392
11393
11394
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11392

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

#subtype_to_hashObject



11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11396

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :key => key,
    :order_number => order_number,
    :card => card,
    :amount => amount,
    :currency => currency,
    :customer => customer,
    :attributes => attributes,
    :destination => destination,
    :result => result,
    :ip => ip,
    :created_at => created_at
  }
end

#to_jsonObject



11388
11389
11390
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11388

def to_json
  JSON.dump(to_hash)
end