Sha256: 7bdd27f9cd7e1a1241fce2096157f0377ffd4051714d906bf13060f814fcea60

Contents?: true

Size: 857 Bytes

Versions: 4

Compression:

Stored size: 857 Bytes

Contents

module AlfaInsurance
  class BusClient < BaseClient
    def calculate(total_cost)
      response = send_soap_request(:calculate_policy) do |xml|
        xml.operator { xml.code(operator) }
        xml.product { xml.code(product_code) }
        xml.policyParameters {
          xml.ticketInformation {
            xml.ticketTotalValue(total_cost.to_f)
          }
        }
      end
      CalculateResponse.new(response)
    end

    def create(insurance_object)
      raise ArgumentError, "BusInsuranceRequest is expected" unless insurance_object.is_a?(BusInsuranceRequest)
      response = send_soap_request(:create_policy) do |xml|
        xml.operator { xml.code(operator) }
        xml.product { xml.code(product_code) }
        xml.policyParameters { insurance_object.generate_xml(xml) }
      end
      CreateResponse.new(response)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alfa_insurance-0.1.4 lib/alfa_insurance/bus_client.rb
alfa_insurance-0.1.3 lib/alfa_insurance/bus_client.rb
alfa_insurance-0.1.2 lib/alfa_insurance/bus_client.rb
alfa_insurance-0.1.1 lib/alfa_insurance/bus_client.rb