Class: BankValInternational::GoValidate
- Inherits:
-
Object
- Object
- BankValInternational::GoValidate
- Defined in:
- lib/BankValInternational.rb
Overview
BankValInternational::GoValidate
Class to make calls to Unified Softwares web services
Instance Method Summary collapse
-
#failover(ser_url) ⇒ Object
Method to make backup REST web service calls and return response if call to the main data centre fails this method is called to make a call to the back up data centre.
-
#validate(ser_url) ⇒ Object
Method to make REST web service calls and return response if call to the main data centre fails the back up method is called to make a call to the back up data centre.
Instance Method Details
#failover(ser_url) ⇒ Object
Method to make backup REST web service calls and return response if call to the main data centre fails this method is called to make a call to the back up data centre
Parameters
-
Serv_url is the services part of the URL for the REST call
Returns
The response from the web service as a string in requested format (XML,JSON or CSV) or.. error message in case of error
310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/BankValInternational.rb', line 310 def failover(ser_url) @base_url = "https://www.unifiedservices.co.uk/services/" uriobj = URI.parse(@base_url) full_path = uriobj.path + ser_url conn = Net::HTTP.new(uriobj.host, uriobj.port) conn.use_ssl = true conn.verify_mode = OpenSSL::SSL::VERIFY_NONE begin webresponse = conn.get2(URI.encode(full_path)) rescue Exception => err return "Network Error" + err end return webresponse end |
#validate(ser_url) ⇒ Object
Method to make REST web service calls and return response if call to the main data centre fails the back up method is called to make a call to the back up data centre
Parameters
-
Serv_url is the services part of the URL for the REST call
Returns
The response from the web service in requested format (XML,JSON or CSV)
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/BankValInternational.rb', line 280 def validate(ser_url) @base_url = "https://www.unifiedsoftware.co.uk/services/" uriobj = URI.parse(@base_url) full_path = uriobj.path + ser_url conn = Net::HTTP.new(uriobj.host, uriobj.port) conn.use_ssl = true conn.verify_mode = OpenSSL::SSL::VERIFY_NONE begin webresponse = conn.get2(URI.encode(full_path)) rescue Exception => err webresponse = failover(ser_url) end if webresponse == nil return "Unknown Error-Check Local Network" end return webresponse.body end |