Class: Io::Flow::V0::Models::AllocationDetail
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AllocationDetail
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#components ⇒ Object
readonly
Returns the value of attribute components.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AllocationDetail
constructor
A new instance of AllocationDetail.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AllocationDetail
Returns a new instance of AllocationDetail.
9300 9301 9302 9303 9304 9305 9306 9307 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9300 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:key, :base, :target, :components], 'AllocationDetail') @key = (x = opts.delete(:key); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetailKey) ? x : ::Io::Flow::V0::Models::OrderPriceDetailKey.apply(x)) @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) @components = HttpClient::Preconditions.assert_class('components', opts.delete(:components), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AllocationDetailComponent) ? x : ::Io::Flow::V0::Models::AllocationDetailComponent.new(x)) } end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
9298 9299 9300 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9298 def base @base end |
#components ⇒ Object (readonly)
Returns the value of attribute components.
9298 9299 9300 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9298 def components @components end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9298 9299 9300 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9298 def key @key end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
9298 9299 9300 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9298 def target @target end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
9313 9314 9315 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9313 def copy(incoming={}) AllocationDetail.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
9317 9318 9319 9320 9321 9322 9323 9324 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9317 def to_hash { :key => key.value, :base => base, :target => target, :components => components.map { |o| o.to_hash } } end |
#to_json ⇒ Object
9309 9310 9311 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9309 def to_json JSON.dump(to_hash) end |