Class: Io::Flow::V0::Models::ReturnPackageRatecardFee

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

Instance Attribute Summary collapse

Attributes inherited from RatecardFee

#discriminator

Instance Method Summary collapse

Methods inherited from RatecardFee

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ReturnPackageRatecardFee

Returns a new instance of ReturnPackageRatecardFee.



47410
47411
47412
47413
47414
47415
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47410

def initialize(incoming={})
  super(:discriminator => RatecardFee::Types::RETURN_PACKAGE_RATECARD_FEE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:amount], 'ReturnPackageRatecardFee')
  @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



47408
47409
47410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47408

def amount
  @amount
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47421
47422
47423
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47421

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

#subtype_to_hashObject



47425
47426
47427
47428
47429
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47425

def subtype_to_hash
  {
    :amount => amount.to_f.to_s
  }
end

#to_jsonObject



47417
47418
47419
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47417

def to_json
  JSON.dump(to_hash)
end