Class: Io::Flow::V0::Models::FuelSurchargeRatecardFee

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 = {}) ⇒ FuelSurchargeRatecardFee

Returns a new instance of FuelSurchargeRatecardFee.



32707
32708
32709
32710
32711
32712
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32707

def initialize(incoming={})
  super(:discriminator => RatecardFee::Types::FUEL_SURCHARGE_RATECARD_FEE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:amount], 'FuelSurchargeRatecardFee')
  @amount = (x = opts.delete(:amount); x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x))
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



32705
32706
32707
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32705

def amount
  @amount
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32718
32719
32720
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32718

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

#subtype_to_hashObject



32722
32723
32724
32725
32726
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32722

def subtype_to_hash
  {
    :amount => amount.to_hash
  }
end

#to_jsonObject



32714
32715
32716
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32714

def to_json
  JSON.dump(to_hash)
end