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.
48433 48434 48435 48436 48437 48438 48439 48440 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48433 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.
48431 48432 48433 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48431 def name @name end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
48431 48432 48433 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48431 def price @price end |
#rate ⇒ Object (readonly)
Returns the value of attribute rate.
48431 48432 48433 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48431 def rate @rate end |
#rate_label ⇒ Object (readonly)
Returns the value of attribute rate_label.
48431 48432 48433 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48431 def rate_label @rate_label end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
48446 48447 48448 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48446 def copy(incoming={}) OrderSummaryPriceDetail.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
48450 48451 48452 48453 48454 48455 48456 48457 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48450 def to_hash { :price => price.to_hash, :name => name, :rate => rate.to_f.to_s, :rate_label => rate_label } end |
#to_json ⇒ Object
48442 48443 48444 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48442 def to_json JSON.dump(to_hash) end |