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.
-
#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:) ⇒ BaseClient
constructor
A new instance of BaseClient.
Constructor Details
#initialize(debug: false, wsdl: SANDBOX_WSDL, operator:, product_code:) ⇒ BaseClient
Returns a new instance of BaseClient.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/alfa_insurance/base_client.rb', line 7 def initialize(debug: false, wsdl: SANDBOX_WSDL, operator:, product_code:) if debug @log_level = :debug @log = true else @log = false end @wsdl = wsdl @operator = operator @product_code = product_code 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 |
#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
32 33 34 |
# File 'lib/alfa_insurance/base_client.rb', line 32 def calculate(*) raise NotImplementedError end |
#cancel(insurance_id) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/alfa_insurance/base_client.rb', line 48 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
40 41 42 43 44 45 46 |
# File 'lib/alfa_insurance/base_client.rb', line 40 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
36 37 38 |
# File 'lib/alfa_insurance/base_client.rb', line 36 def create(*) raise NotImplementedError end |
#find(insurance_id) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/alfa_insurance/base_client.rb', line 56 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
19 20 21 22 23 |
# File 'lib/alfa_insurance/base_client.rb', line 19 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
25 26 27 28 29 30 |
# File 'lib/alfa_insurance/base_client.rb', line 25 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 |