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.
13821 13822 13823 13824 13825 13826 13827 13828 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13821 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.
13819 13820 13821 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13819 def details @details end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
13819 13820 13821 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13819 def id @id end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
13819 13820 13821 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13819 def order @order end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
13819 13820 13821 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13819 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
13834 13835 13836 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13834 def copy(incoming={}) AllocationV2.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
13838 13839 13840 13841 13842 13843 13844 13845 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13838 def to_hash { :id => id, :order => order.to_hash, :details => details.map { |o| o.to_hash }, :total => total.to_hash } end |
#to_json ⇒ Object
13830 13831 13832 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13830 def to_json JSON.dump(to_hash) end |