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.
42292 42293 42294 42295 42296 42297 42298 42299 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42292 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.
42290 42291 42292 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42290 def name @name end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
42290 42291 42292 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42290 def price @price end |
#rate ⇒ Object (readonly)
Returns the value of attribute rate.
42290 42291 42292 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42290 def rate @rate end |
#rate_label ⇒ Object (readonly)
Returns the value of attribute rate_label.
42290 42291 42292 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42290 def rate_label @rate_label end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
42305 42306 42307 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42305 def copy(incoming={}) OrderSummaryPriceDetail.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
42309 42310 42311 42312 42313 42314 42315 42316 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42309 def to_hash { :price => price.to_hash, :name => name, :rate => rate.to_f.to_s, :rate_label => rate_label } end |
#to_json ⇒ Object
42301 42302 42303 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42301 def to_json JSON.dump(to_hash) end |