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.
54332 54333 54334 54335 54336 54337 54338 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54332 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.
54330 54331 54332 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54330 def rate @rate end |
#rate_label ⇒ Object (readonly)
Returns the value of attribute rate_label.
54330 54331 54332 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54330 def rate_label @rate_label end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
54330 54331 54332 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54330 def value @value end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
54344 54345 54346 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54344 def copy(incoming={}) OrderSummaryLevy.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
54348 54349 54350 54351 54352 54353 54354 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54348 def to_hash { :rate => rate.to_f.to_s, :rate_label => rate_label, :value => value.to_hash } end |
#to_json ⇒ Object
54340 54341 54342 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54340 def to_json JSON.dump(to_hash) end |