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

#to_hash

Constructor Details

#initialize(incoming = {}) ⇒ RateUpserted

Returns a new instance of RateUpserted.



18949
18950
18951
18952
18953
18954
18955
18956
18957
18958
18959
18960
18961
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18949

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

#base ⇒ Object (readonly)

Returns the value of attribute base.



18947
18948
18949
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18947

def base
  @base
end

#effective_at ⇒ Object (readonly)

Returns the value of attribute effective_at.



18947
18948
18949
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18947

def effective_at
  @effective_at
end

#event_id ⇒ Object (readonly)

Returns the value of attribute event_id.



18947
18948
18949
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18947

def event_id
  @event_id
end

#organization_id ⇒ Object (readonly)

Returns the value of attribute organization_id.



18947
18948
18949
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18947

def organization_id
  @organization_id
end

#rate_id ⇒ Object (readonly)

Returns the value of attribute rate_id.



18947
18948
18949
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18947

def rate_id
  @rate_id
end

#target ⇒ Object (readonly)

Returns the value of attribute target.



18947
18948
18949
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18947

def target
  @target
end

#timestamp ⇒ Object (readonly)

Returns the value of attribute timestamp.



18947
18948
18949
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18947

def timestamp
  @timestamp
end

#value ⇒ Object (readonly)

Returns the value of attribute value.



18947
18948
18949
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18947

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



18967
18968
18969
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18967

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

#subtype_to_hash ⇒ Object



18971
18972
18973
18974
18975
18976
18977
18978
18979
18980
18981
18982
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18971

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
  }
end

#to_json ⇒ Object



18963
18964
18965
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18963

def to_json
  JSON.dump(to_hash)
end