class Request
Public Class Methods
client_service_get(host, path, retries = 1)
click to toggle source
Will do a request path will be evaluated so there could be parameters in that one and then use ” for the string to have the parameters evaluated in this function
# File lib/utils/request.rb, line 37 def self.client_service_get(host, path, retries = 1) url = get_base_url(host) + path logger.debug "Will request url #{url}" result = with_retries(:limit => retries, :sleep=> 5) { RestClient.get url } result_json = JSON.parse(result) logger.debug "The result of the request is #{result.inspect}" result_json end
client_service_post(url, param, retries = 1)
click to toggle source
# File lib/utils/request.rb, line 46 def self.client_service_post(url, param, retries = 1) logger.debug "Will request url #{url}" result = with_retries(:limit => retries, :sleep=> 5) { RestClient.post url, param } JSON.parse(result) end
get_base_url(host)
click to toggle source
Get a base url for accessing the client service TODO Change this to https but we need a certificate for that
# File lib/utils/request.rb, line 25 def self.get_base_url(host) url = host url = "http://" + url unless url[0..3] == "http" url end