Sha256: 518cea79b92dc7d4644e0f7a0f1aadbf79d8dff7e4fddf459bb0b9e4ab3e9ac7

Contents?: true

Size: 854 Bytes

Versions: 1

Compression:

Stored size: 854 Bytes

Contents

module AlfaInsurance
  class BusClient < BaseClient
    def calculate(total_cost)
      response = send_soap_request(:create_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

1 entries across 1 versions & 1 rubygems

Version Path
alfa_insurance-0.1.0 lib/alfa_insurance/bus_client.rb