Class: IFD_Soap
- Inherits:
-
Object
- Object
- IFD_Soap
- Defined in:
- lib/helper/soap_helper.rb
Class Method Summary collapse
- .call_and_fail_gracefully(client, *args, &block) ⇒ Object
- .get_soap_operation_list(url) ⇒ Object
- .get_soap_response ⇒ Object
- .print_response ⇒ Object
- .send_soap_with_operation_and_data(operation, data) ⇒ Object
- .send_soap_with_operation_and_xml(operation, file_name) ⇒ Object
- .verify_response_code(status_code) ⇒ Object
- .verify_response_with_json_node(json_node, string) ⇒ Object
Class Method Details
.call_and_fail_gracefully(client, *args, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/helper/soap_helper.rb', line 15 def self.call_and_fail_gracefully(client, *args, &block) if client.nil? raise "ERROR***: MISSING STEPS: Please run step to get operation list from WSDL first." else client.call(*args, &block) end rescue Savon::SOAPFault => e raise e. end |
.get_soap_operation_list(url) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/helper/soap_helper.rb', line 5 def self.get_soap_operation_list(url) request_url = URI.encode Utils.check_dynamic_value url @SOAPclient = Savon.client(ssl_verify_mode: :none, wsdl: "#{request_url}", :open_timeout => 10, :read_timeout => 10, :log => false) p "Operations List: #{@SOAPclient.operations}" end |
.get_soap_response ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/helper/soap_helper.rb', line 25 def self.get_soap_response soap_response = @response if soap_response.nil? raise "ERROR***: MISSING STEPS: Please send SOAP request to get the response first." else soap_response end soap_response end |
.print_response ⇒ Object
55 56 57 |
# File 'lib/helper/soap_helper.rb', line 55 def self.print_response p "SOAP RESPONSE: #{IFD_Soap.get_soap_response}" end |
.send_soap_with_operation_and_data(operation, data) ⇒ Object
40 41 42 43 |
# File 'lib/helper/soap_helper.rb', line 40 def self.send_soap_with_operation_and_data(operation,data) xml = Utils.bind_with_dyn_vars(data) @response = IFD_Soap.call_and_fail_gracefully(@SOAPclient, operation.downcase.to_sym, xml: xml ) end |
.send_soap_with_operation_and_xml(operation, file_name) ⇒ Object
35 36 37 38 |
# File 'lib/helper/soap_helper.rb', line 35 def self.send_soap_with_operation_and_xml(operation,file_name) xml = File.read($test_data_dir + file_name) @response = IFD_Soap.call_and_fail_gracefully(@SOAPclient, operation.downcase.to_sym, xml: xml ) end |
.verify_response_code(status_code) ⇒ Object
51 52 53 |
# File 'lib/helper/soap_helper.rb', line 51 def self.verify_response_code(status_code) IFD_Assertion.assert_string_equal(IFD_Soap.get_soap_response.http.code, status_code.to_i) end |
.verify_response_with_json_node(json_node, string) ⇒ Object
45 46 47 48 49 |
# File 'lib/helper/soap_helper.rb', line 45 def self.verify_response_with_json_node(json_node,string) json = IFD_Soap.get_soap_response.body.to_json results = JsonPath.new(json_node).on(json).to_a.map(&:to_s) IFD_Assertion.assert_string_equal(string, results[0]) end |