Class: AlfaInsurance::BaseClient
- Inherits:
-
Object
- Object
- AlfaInsurance::BaseClient
- Defined in:
- lib/alfa_insurance/base_client.rb
Direct Known Subclasses
Constant Summary collapse
- SANDBOX_WSDL =
'https://uat-tes.alfastrah.ru/travel-ext-services/TravelExtService?wsdl'.freeze
Instance Attribute Summary collapse
-
#log ⇒ Object
Returns the value of attribute log.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#operator ⇒ Object
Returns the value of attribute operator.
-
#product_code ⇒ Object
Returns the value of attribute product_code.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#wsdl ⇒ Object
Returns the value of attribute wsdl.
Instance Method Summary collapse
- #calculate ⇒ Object
- #cancel(insurance_id) ⇒ Object
- #confirm(insurance_id) ⇒ Object
- #create ⇒ Object
- #find(insurance_id) ⇒ Object
- #get_available_products ⇒ Object
- #get_policy_parameters(product_code) ⇒ Object
-
#initialize(debug: false, wsdl: SANDBOX_WSDL, operator:, product_code:, timeout: 5) ⇒ BaseClient
constructor
A new instance of BaseClient.
Constructor Details
#initialize(debug: false, wsdl: SANDBOX_WSDL, operator:, product_code:, timeout: 5) ⇒ BaseClient
Returns a new instance of BaseClient.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/alfa_insurance/base_client.rb', line 7 def initialize(debug: false, wsdl: SANDBOX_WSDL, operator:, product_code:, timeout: 5) if debug @log_level = :debug @log = true else @log = false end @wsdl = wsdl @operator = operator @product_code = product_code @timeout = timeout end |
Instance Attribute Details
#log ⇒ Object
Returns the value of attribute log.
5 6 7 |
# File 'lib/alfa_insurance/base_client.rb', line 5 def log @log end |
#log_level ⇒ Object
Returns the value of attribute log_level.
5 6 7 |
# File 'lib/alfa_insurance/base_client.rb', line 5 def log_level @log_level end |
#operator ⇒ Object
Returns the value of attribute operator.
5 6 7 |
# File 'lib/alfa_insurance/base_client.rb', line 5 def operator @operator end |
#product_code ⇒ Object
Returns the value of attribute product_code.
5 6 7 |
# File 'lib/alfa_insurance/base_client.rb', line 5 def product_code @product_code end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/alfa_insurance/base_client.rb', line 5 def timeout @timeout end |
#wsdl ⇒ Object
Returns the value of attribute wsdl.
5 6 7 |
# File 'lib/alfa_insurance/base_client.rb', line 5 def wsdl @wsdl end |
Instance Method Details
#calculate ⇒ Object
33 34 35 |
# File 'lib/alfa_insurance/base_client.rb', line 33 def calculate(*) raise NotImplementedError end |
#cancel(insurance_id) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/alfa_insurance/base_client.rb', line 49 def cancel(insurance_id) response = send_soap_request(:cancel_policy) do |xml| xml.operator { xml.code(operator) } xml.policyId(insurance_id) end Response.new(response) end |
#confirm(insurance_id) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/alfa_insurance/base_client.rb', line 41 def confirm(insurance_id) response = send_soap_request(:confirm_policy) do |xml| xml.operator { xml.code(operator) } xml.policyId(insurance_id) end ConfirmResponse.new(response) end |
#create ⇒ Object
37 38 39 |
# File 'lib/alfa_insurance/base_client.rb', line 37 def create(*) raise NotImplementedError end |
#find(insurance_id) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/alfa_insurance/base_client.rb', line 57 def find(insurance_id) response = send_soap_request(:get_policy) do |xml| xml.operator { xml.code(operator) } xml.policyId(insurance_id) end FindResponse.new(response) end |
#get_available_products ⇒ Object
20 21 22 23 24 |
# File 'lib/alfa_insurance/base_client.rb', line 20 def get_available_products send_soap_request(:get_available_products) do |xml| xml.operator { xml.code(operator) } end.body end |
#get_policy_parameters(product_code) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/alfa_insurance/base_client.rb', line 26 def get_policy_parameters(product_code) send_soap_request(:get_policy_parameters) do |xml| xml.operator { xml.code(operator) } xml.product { xml.code(product_code) } end.body end |