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.
41554 41555 41556 41557 41558 41559 41560 41561 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41554 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.
41552 41553 41554 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41552 def name @name end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
41552 41553 41554 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41552 def price @price end |
#rate ⇒ Object (readonly)
Returns the value of attribute rate.
41552 41553 41554 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41552 def rate @rate end |
#rate_label ⇒ Object (readonly)
Returns the value of attribute rate_label.
41552 41553 41554 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41552 def rate_label @rate_label end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
41567 41568 41569 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41567 def copy(incoming={}) OrderSummaryPriceDetail.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
41571 41572 41573 41574 41575 41576 41577 41578 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41571 def to_hash { :price => price.to_hash, :name => name, :rate => rate.to_f.to_s, :rate_label => rate_label } end |
#to_json ⇒ Object
41563 41564 41565 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41563 def to_json JSON.dump(to_hash) end |