Class: Io::Flow::V0::Models::AllocationV2
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AllocationV2
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AllocationV2
constructor
A new instance of AllocationV2.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AllocationV2
Returns a new instance of AllocationV2.
26653 26654 26655 26656 26657 26658 26659 26660 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26653 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :order, :details, :total], 'AllocationV2') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @order = (x = opts.delete(:order); x.is_a?(::Io::Flow::V0::Models::AllocationOrderSummary) ? x : ::Io::Flow::V0::Models::AllocationOrderSummary.new(x)) @details = HttpClient::Preconditions.assert_class('details', opts.delete(:details), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AllocationDetail) ? x : ::Io::Flow::V0::Models::AllocationDetail.from_json(x)) } @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::LocalizedTotal) ? x : ::Io::Flow::V0::Models::LocalizedTotal.new(x)) end |
Instance Attribute Details
#details ⇒ Object (readonly)
Returns the value of attribute details.
26651 26652 26653 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26651 def details @details end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
26651 26652 26653 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26651 def id @id end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
26651 26652 26653 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26651 def order @order end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
26651 26652 26653 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26651 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
26666 26667 26668 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26666 def copy(incoming={}) AllocationV2.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
26670 26671 26672 26673 26674 26675 26676 26677 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26670 def to_hash { :id => id, :order => order.to_hash, :details => details.map { |o| o.to_hash }, :total => total.to_hash } end |
#to_json ⇒ Object
26662 26663 26664 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26662 def to_json JSON.dump(to_hash) end |