Class: Dhl::Intraship::HigherInsuranceService

Inherits:
Service
  • Object
show all
Defined in:
lib/dhl-intraship/service/higher_insurance_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(amount = 2500, currency = 'EUR') ⇒ HigherInsuranceService

Returns a new instance of HigherInsuranceService.



5
6
7
8
9
10
11
# File 'lib/dhl-intraship/service/higher_insurance_service.rb', line 5

def initialize(amount = 2500, currency = 'EUR')
  @amount, @currency = amount, currency

  unless [2500, 25000].include?(@amount)
    raise 'The insurance amount have to be 2500 or 25000!'
  end
end

Instance Method Details

#append_to_xml(xml) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/dhl-intraship/service/higher_insurance_service.rb', line 13

def append_to_xml(xml)
  xml.Service do |xml|
    xml.ServiceGroupOther do |xml|
      xml.HigherInsurance do |xml|
        xml.InsuranceAmount(@amount)
        xml.InsuranceCurrency(@currency)
      end
    end
  end
end