Class: Io::Flow::V0::Models::Rate
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Rate
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents an organization-specific currency conversion rate at a point in time.
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#effective_at ⇒ Object
readonly
Returns the value of attribute effective_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Rate
constructor
A new instance of Rate.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Rate
Returns a new instance of Rate.
61566 61567 61568 61569 61570 61571 61572 61573 61574 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61566 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :base, :target, :effective_at, :value], 'Rate') @id = HttpClient::Preconditions.assert_class('id', opts.delete(: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.
61564 61565 61566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61564 def base @base end |
#effective_at ⇒ Object (readonly)
Returns the value of attribute effective_at.
61564 61565 61566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61564 def effective_at @effective_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
61564 61565 61566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61564 def id @id end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
61564 61565 61566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61564 def target @target end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
61564 61565 61566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61564 def value @value end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
61580 61581 61582 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61580 def copy(incoming={}) Rate.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
61584 61585 61586 61587 61588 61589 61590 61591 61592 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61584 def to_hash { :id => id, :base => base, :target => target, :effective_at => effective_at, :value => value.to_f.to_s } end |
#to_json ⇒ Object
61576 61577 61578 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61576 def to_json JSON.dump(to_hash) end |