Class: Io::Flow::V0::Models::FlowCurrencySettingUpserted

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

Returns a new instance of FlowCurrencySettingUpserted.



10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10261

def initialize(incoming={})
  super(:name => Event::Types::FLOW_CURRENCY_SETTING_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :flow_currency_setting_id, :organization_id, :base, :target, :margin, :rate_lock_unit, :rate_lock_value], 'FlowCurrencySettingUpserted')
  @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)
  @flow_currency_setting_id = HttpClient::Preconditions.assert_class('flow_currency_setting_id', opts.delete(:flow_currency_setting_id), String)
  @organization_id = HttpClient::Preconditions.assert_class('organization_id', opts.delete(:organization_id), String)
  @base = HttpClient::Preconditions.assert_class('base', opts.delete(:base), String)
  @target = HttpClient::Preconditions.assert_class('target', opts.delete(:target), String)
  @margin = HttpClient::Preconditions.assert_class('margin', HttpClient::Helper.to_big_decimal(opts.delete(:margin)), BigDecimal)
  @rate_lock_unit = HttpClient::Preconditions.assert_class('rate_lock_unit', opts.delete(:rate_lock_unit), String)
  @rate_lock_value = HttpClient::Preconditions.assert_class('rate_lock_value', opts.delete(:rate_lock_value), Integer)
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



10259
10260
10261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10259

def base
  @base
end

#event_idObject (readonly)

Returns the value of attribute event_id.



10259
10260
10261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10259

def event_id
  @event_id
end

#flow_currency_setting_idObject (readonly)

Returns the value of attribute flow_currency_setting_id.



10259
10260
10261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10259

def flow_currency_setting_id
  @flow_currency_setting_id
end

#marginObject (readonly)

Returns the value of attribute margin.



10259
10260
10261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10259

def margin
  @margin
end

#organization_idObject (readonly)

Returns the value of attribute organization_id.



10259
10260
10261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10259

def organization_id
  @organization_id
end

#rate_lock_unitObject (readonly)

Returns the value of attribute rate_lock_unit.



10259
10260
10261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10259

def rate_lock_unit
  @rate_lock_unit
end

#rate_lock_valueObject (readonly)

Returns the value of attribute rate_lock_value.



10259
10260
10261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10259

def rate_lock_value
  @rate_lock_value
end

#targetObject (readonly)

Returns the value of attribute target.



10259
10260
10261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10259

def target
  @target
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



10259
10260
10261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10259

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



10280
10281
10282
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10280

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

#subtype_to_hashObject



10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10284

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :flow_currency_setting_id => flow_currency_setting_id,
    :organization_id => organization_id,
    :base => base,
    :target => target,
    :margin => margin,
    :rate_lock_unit => rate_lock_unit,
    :rate_lock_value => rate_lock_value
  }
end

#to_jsonObject



10276
10277
10278
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10276

def to_json
  JSON.dump(to_hash)
end