Class: Io::Flow::V0::Models::CaptureUpserted

Inherits:
Event
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ CaptureUpserted

Returns a new instance of CaptureUpserted.



7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7883

def initialize(incoming={})
  super(:name => Event::Types::CAPTURE_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :key, :authorization_key, :amount, :currency, :created_at], 'CaptureUpserted')
  @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)
  @authorization_key = HttpClient::Preconditions.assert_class('authorization_key', opts.delete(:authorization_key), String)
  @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)
  @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.



7881
7882
7883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7881

def amount
  @amount
end

#authorization_keyObject (readonly)

Returns the value of attribute authorization_key.



7881
7882
7883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7881

def authorization_key
  @authorization_key
end

#created_atObject (readonly)

Returns the value of attribute created_at.



7881
7882
7883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7881

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



7881
7882
7883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7881

def currency
  @currency
end

#event_idObject (readonly)

Returns the value of attribute event_id.



7881
7882
7883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7881

def event_id
  @event_id
end

#keyObject (readonly)

Returns the value of attribute key.



7881
7882
7883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7881

def key
  @key
end

#organizationObject (readonly)

Returns the value of attribute organization.



7881
7882
7883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7881

def organization
  @organization
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



7881
7882
7883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7881

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



7901
7902
7903
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7901

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

#subtype_to_hashObject



7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7905

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :key => key,
    :authorization_key => authorization_key,
    :amount => amount,
    :currency => currency,
    :created_at => created_at
  }
end

#to_jsonObject



7897
7898
7899
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7897

def to_json
  JSON.dump(to_hash)
end