Class: Io::Flow::V0::Models::OrderSummaryPriceDetail
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OrderSummaryPriceDetail
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Summaries the io.flow.order.price.v0.models.order_price_detail, removing components and accuracy which are not needed for summary views
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#rate ⇒ Object
readonly
Returns the value of attribute rate.
-
#rate_label ⇒ Object
readonly
Returns the value of attribute rate_label.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ OrderSummaryPriceDetail
constructor
A new instance of OrderSummaryPriceDetail.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OrderSummaryPriceDetail
Returns a new instance of OrderSummaryPriceDetail.
40308 40309 40310 40311 40312 40313 40314 40315 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40308 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price], 'OrderSummaryPriceDetail') @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) @name = (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, String)) @rate = (x = opts.delete(:rate); x.nil? ? nil : HttpClient::Preconditions.assert_class('rate', HttpClient::Helper.to_big_decimal(x), BigDecimal)) @rate_label = (x = opts.delete(:rate_label); x.nil? ? nil : HttpClient::Preconditions.assert_class('rate_label', x, String)) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
40306 40307 40308 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40306 def name @name end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
40306 40307 40308 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40306 def price @price end |
#rate ⇒ Object (readonly)
Returns the value of attribute rate.
40306 40307 40308 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40306 def rate @rate end |
#rate_label ⇒ Object (readonly)
Returns the value of attribute rate_label.
40306 40307 40308 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40306 def rate_label @rate_label end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
40321 40322 40323 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40321 def copy(incoming={}) OrderSummaryPriceDetail.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
40325 40326 40327 40328 40329 40330 40331 40332 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40325 def to_hash { :price => price.to_hash, :name => name, :rate => rate.to_f.to_s, :rate_label => rate_label } end |
#to_json ⇒ Object
40317 40318 40319 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40317 def to_json JSON.dump(to_hash) end |