Class: Io::Flow::V0::Models::RateUpserted
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#effective_at ⇒ Object
readonly
Returns the value of attribute effective_at.
-
#event_id ⇒ Object
readonly
Returns the value of attribute event_id.
-
#organization_id ⇒ Object
readonly
Returns the value of attribute organization_id.
-
#rate_id ⇒ Object
readonly
Returns the value of attribute rate_id.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Event
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ RateUpserted
constructor
A new instance of RateUpserted.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Event
Constructor Details
#initialize(incoming = {}) ⇒ RateUpserted
46472 46473 46474 46475 46476 46477 46478 46479 46480 46481 46482 46483 46484 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46472 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.
46470 46471 46472 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46470 def base @base end |
#effective_at ⇒ Object (readonly)
Returns the value of attribute effective_at.
46470 46471 46472 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46470 def effective_at @effective_at end |
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
46470 46471 46472 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46470 def event_id @event_id end |
#organization_id ⇒ Object (readonly)
Returns the value of attribute organization_id.
46470 46471 46472 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46470 def organization_id @organization_id end |
#rate_id ⇒ Object (readonly)
Returns the value of attribute rate_id.
46470 46471 46472 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46470 def rate_id @rate_id end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
46470 46471 46472 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46470 def target @target end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
46470 46471 46472 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46470 def @timestamp end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
46470 46471 46472 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46470 def value @value end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
46490 46491 46492 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46490 def copy(incoming={}) RateUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
46494 46495 46496 46497 46498 46499 46500 46501 46502 46503 46504 46505 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46494 def subtype_to_hash { :event_id => event_id, :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_json ⇒ Object
46486 46487 46488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46486 def to_json JSON.dump(to_hash) end |