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
40874 40875 40876 40877 40878 40879 40880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40874 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.
40872 40873 40874 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40872 def rate @rate end |
#rate_label ⇒ Object (readonly)
Returns the value of attribute rate_label.
40872 40873 40874 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40872 def rate_label @rate_label end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
40872 40873 40874 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40872 def value @value end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
40886 40887 40888 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40886 def copy(incoming={}) OrderSummaryLevy.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
40890 40891 40892 40893 40894 40895 40896 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40890 def to_hash { :rate => rate.to_f.to_s, :rate_label => rate_label, :value => value.to_hash } end |
#to_json ⇒ Object
40882 40883 40884 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40882 def to_json JSON.dump(to_hash) end |