Class: Io::Flow::V0::Models::OrderSummaryLevy
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OrderSummaryLevy
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#rate ⇒ Object
readonly
Returns the value of attribute rate.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ OrderSummaryLevy
constructor
A new instance of OrderSummaryLevy.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OrderSummaryLevy
39027 39028 39029 39030 39031 39032 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39027 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:rate, :value], 'OrderSummaryLevy') @rate = HttpClient::Preconditions.assert_class('rate', HttpClient::Helper.to_big_decimal(opts.delete(:rate)), BigDecimal) @value = (x = opts.delete(:value); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) end |
Instance Attribute Details
#rate ⇒ Object (readonly)
Returns the value of attribute rate.
39025 39026 39027 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39025 def rate @rate end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
39025 39026 39027 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39025 def value @value end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
39038 39039 39040 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39038 def copy(incoming={}) OrderSummaryLevy.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
39042 39043 39044 39045 39046 39047 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39042 def to_hash { :rate => rate.to_f.to_s, :value => value.to_hash } end |
#to_json ⇒ Object
39034 39035 39036 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39034 def to_json JSON.dump(to_hash) end |