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.



40686
40687
40688
40689
40690
40691
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40686

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.



40684
40685
40686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40684

def amount
  @amount
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



40697
40698
40699
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40697

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

#subtype_to_hashObject



40701
40702
40703
40704
40705
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40701

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

#to_jsonObject



40693
40694
40695
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40693

def to_json
  JSON.dump(to_hash)
end