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.



64150
64151
64152
64153
64154
64155
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64150

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.



64148
64149
64150
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64148

def amount
  @amount
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



64161
64162
64163
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64161

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

#subtype_to_hashObject



64165
64166
64167
64168
64169
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64165

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

#to_jsonObject



64157
64158
64159
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64157

def to_json
  JSON.dump(to_hash)
end