Class: Io::Flow::V0::Models::RateUpserted

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

Returns a new instance of RateUpserted.



45884
45885
45886
45887
45888
45889
45890
45891
45892
45893
45894
45895
45896
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45884

def initialize(incoming={})
  super(:discriminator => Event::Types::RATE_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :rate_id, :organization_id, :base, :target, :effective_at, :value], 'RateUpserted')
  @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)
  @rate_id = HttpClient::Preconditions.assert_class('rate_id', opts.delete(:rate_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)
  @effective_at = HttpClient::Preconditions.assert_class('effective_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:effective_at)), DateTime)
  @value = HttpClient::Preconditions.assert_class('value', HttpClient::Helper.to_big_decimal(opts.delete(:value)), BigDecimal)
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



45882
45883
45884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45882

def base
  @base
end

#effective_atObject (readonly)

Returns the value of attribute effective_at.



45882
45883
45884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45882

def effective_at
  @effective_at
end

#event_idObject (readonly)

Returns the value of attribute event_id.



45882
45883
45884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45882

def event_id
  @event_id
end

#organization_idObject (readonly)

Returns the value of attribute organization_id.



45882
45883
45884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45882

def organization_id
  @organization_id
end

#rate_idObject (readonly)

Returns the value of attribute rate_id.



45882
45883
45884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45882

def rate_id
  @rate_id
end

#targetObject (readonly)

Returns the value of attribute target.



45882
45883
45884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45882

def target
  @target
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



45882
45883
45884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45882

def timestamp
  @timestamp
end

#valueObject (readonly)

Returns the value of attribute value.



45882
45883
45884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45882

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



45902
45903
45904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45902

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

#subtype_to_hashObject



45906
45907
45908
45909
45910
45911
45912
45913
45914
45915
45916
45917
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45906

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :rate_id => rate_id,
    :organization_id => organization_id,
    :base => base,
    :target => target,
    :effective_at => effective_at,
    :value => value.to_f.to_s
  }
end

#to_jsonObject



45898
45899
45900
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45898

def to_json
  JSON.dump(to_hash)
end