Class: Io::Flow::V0::Models::AllocationTotals

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ AllocationTotals

Returns a new instance of AllocationTotals.



9394
9395
9396
9397
9398
9399
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9394

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:target, :base], 'AllocationTotals')
  @target = HttpClient::Preconditions.assert_class('target', HttpClient::Helper.to_big_decimal(opts.delete(:target)), BigDecimal)
  @base = HttpClient::Preconditions.assert_class('base', HttpClient::Helper.to_big_decimal(opts.delete(:base)), BigDecimal)
end

Instance Attribute Details

#base ⇒ Object (readonly)

Returns the value of attribute base.



9392
9393
9394
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9392

def base
  @base
end

#target ⇒ Object (readonly)

Returns the value of attribute target.



9392
9393
9394
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9392

def target
  @target
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



9405
9406
9407
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9405

def copy(incoming={})
  AllocationTotals.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hash ⇒ Object



9409
9410
9411
9412
9413
9414
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9409

def to_hash
  {
    :target => target,
    :base => base
  }
end

#to_json ⇒ Object



9401
9402
9403
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9401

def to_json
  JSON.dump(to_hash)
end