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



9443
9444
9445
9446
9447
9448
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9443

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

#baseObject (readonly)

Returns the value of attribute base.



9441
9442
9443
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9441

def base
  @base
end

#targetObject (readonly)

Returns the value of attribute target.



9441
9442
9443
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9441

def target
  @target
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



9454
9455
9456
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9454

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

#to_hashObject



9458
9459
9460
9461
9462
9463
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9458

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

#to_jsonObject



9450
9451
9452
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9450

def to_json
  JSON.dump(to_hash)
end