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.



31037
31038
31039
31040
31041
31042
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31037

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.



31035
31036
31037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31035

def amount
  @amount
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



31048
31049
31050
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31048

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

#subtype_to_hashObject



31052
31053
31054
31055
31056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31052

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

#to_jsonObject



31044
31045
31046
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31044

def to_json
  JSON.dump(to_hash)
end