Class: Io::Flow::V0::Models::EmergencySituationSurchargeServiceFee

Inherits:
ServiceFee
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from ServiceFee

#discriminator

Instance Method Summary collapse

Methods inherited from ServiceFee

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ EmergencySituationSurchargeServiceFee

Returns a new instance of EmergencySituationSurchargeServiceFee.



30656
30657
30658
30659
30660
30661
30662
30663
30664
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30656

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

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



30654
30655
30656
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30654

def amount
  @amount
end

#destination_regionObject (readonly)

Returns the value of attribute destination_region.



30654
30655
30656
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30654

def destination_region
  @destination_region
end

#interval_unitObject (readonly)

Returns the value of attribute interval_unit.



30654
30655
30656
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30654

def interval_unit
  @interval_unit
end

#origin_regionObject (readonly)

Returns the value of attribute origin_region.



30654
30655
30656
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30654

def origin_region
  @origin_region
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30670
30671
30672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30670

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

#subtype_to_hashObject



30674
30675
30676
30677
30678
30679
30680
30681
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30674

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_jsonObject



30666
30667
30668
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30666

def to_json
  JSON.dump(to_hash)
end