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.
-
#rate_label ⇒ Object
readonly
Returns the value of attribute rate_label.
-
#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
Returns a new instance of OrderSummaryLevy.
41632 41633 41634 41635 41636 41637 41638 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41632 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) @rate_label = (x = opts.delete(:rate_label); x.nil? ? nil : HttpClient::Preconditions.assert_class('rate_label', x, String)) @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.
41630 41631 41632 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41630 def rate @rate end |
#rate_label ⇒ Object (readonly)
Returns the value of attribute rate_label.
41630 41631 41632 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41630 def rate_label @rate_label end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
41630 41631 41632 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41630 def value @value end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
41644 41645 41646 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41644 def copy(incoming={}) OrderSummaryLevy.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
41648 41649 41650 41651 41652 41653 41654 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41648 def to_hash { :rate => rate.to_f.to_s, :rate_label => rate_label, :value => value.to_hash } end |
#to_json ⇒ Object
41640 41641 41642 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41640 def to_json JSON.dump(to_hash) end |