class BankValInternational::GoValidate

BankValInternational::GoValidate

Class to make calls to Unified Softwares web services

Public Instance Methods

failover(ser_url) click to toggle source

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

  1. 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

# 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) click to toggle source

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

  1. 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)

# 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