Class: Io::Flow::V0::Models::AllocationItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AllocationItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AllocationItem
constructor
A new instance of AllocationItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AllocationItem
Returns a new instance of AllocationItem.
9362 9363 9364 9365 9366 9367 9368 9369 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9362 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:number, :base, :target, :details], 'AllocationItem') @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @base = HttpClient::Preconditions.assert_class('base', HttpClient::Helper.to_big_decimal(opts.delete(:base)), BigDecimal) @target = HttpClient::Preconditions.assert_class('target', HttpClient::Helper.to_big_decimal(opts.delete(:target)), BigDecimal) @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.new(x)) } end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
9360 9361 9362 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9360 def base @base end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
9360 9361 9362 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9360 def details @details end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
9360 9361 9362 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9360 def number @number end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
9360 9361 9362 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9360 def target @target end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
9375 9376 9377 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9375 def copy(incoming={}) AllocationItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
9379 9380 9381 9382 9383 9384 9385 9386 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9379 def to_hash { :number => number, :base => base, :target => target, :details => details.map { |o| o.to_hash } } end |
#to_json ⇒ Object
9371 9372 9373 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9371 def to_json JSON.dump(to_hash) end |