class Io::Flow::V0::Models::EmergencySituationSurchargeServiceFee

Attributes

amount[R]
destination_region[R]
interval_unit[R]
origin_region[R]

Public Class Methods

new(incoming={}) click to toggle source
Calls superclass method Io::Flow::V0::Models::ServiceFee::new
# File lib/flow_commerce/flow_api_v0_client.rb, line 41081
def initialize(incoming={})
  super(:discriminator => ServiceFee::Types::EMERGENCY_SITUATION_SURCHARGE_SERVICE_FEE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:amount], 'EmergencySituationSurchargeServiceFee')
  @amount = (x = opts.delete(:amount); x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x))
  @origin_region = (x = opts.delete(:origin_region); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::RatecardRegionReference) ? x : ::Io::Flow::V0::Models::RatecardRegionReference.new(x)))
  @destination_region = (x = opts.delete(:destination_region); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::RatecardRegionReference) ? x : ::Io::Flow::V0::Models::RatecardRegionReference.new(x)))
  @interval_unit = (x = opts.delete(:interval_unit); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::UnitOfMeasurement) ? x : ::Io::Flow::V0::Models::UnitOfMeasurement.apply(x)))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 41095
def copy(incoming={})
  EmergencySituationSurchargeServiceFee.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 41099
def subtype_to_hash
  {
    :amount => amount.to_hash,
    :origin_region => origin_region.nil? ? nil : origin_region.to_hash,
    :destination_region => destination_region.nil? ? nil : destination_region.to_hash,
    :interval_unit => interval_unit.nil? ? nil : interval_unit.value
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 41091
def to_json
  JSON.dump(to_hash)
end