Class: Io::Flow::V0::Models::AllocationDetailComponent
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AllocationDetailComponent
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#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 = {}) ⇒ AllocationDetailComponent
constructor
A new instance of AllocationDetailComponent.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AllocationDetailComponent
Returns a new instance of AllocationDetailComponent.
9381 9382 9383 9384 9385 9386 9387 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9381 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:key, :base, :target], 'AllocationDetailComponent') @key = (x = opts.delete(:key); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetailComponentKey) ? x : ::Io::Flow::V0::Models::OrderPriceDetailComponentKey.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) end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
9379 9380 9381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9379 def base @base end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9379 9380 9381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9379 def key @key end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
9379 9380 9381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9379 def target @target end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
9393 9394 9395 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9393 def copy(incoming={}) AllocationDetailComponent.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
9397 9398 9399 9400 9401 9402 9403 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9397 def to_hash { :key => key.value, :base => base, :target => target } end |
#to_json ⇒ Object
9389 9390 9391 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9389 def to_json JSON.dump(to_hash) end |