class MoesifApi::HttpClient

Public Instance Methods

convert_response(response) click to toggle source

Converts the HTTP Response from the client to an HttpResponse object. @param [Dynamic] The response object received from the client.

# File lib/moesif_api/http/http_client.rb, line 19
def convert_response(response)
  raise NotImplementedError, "This method needs to be implemented in a child class."
end
delete(query_url, headers: nil, username: nil, password: nil) click to toggle source

Get a DELETE HttpRequest object. @param [String] The URL to send the request to. @param [Hash, Optional] The headers for the HTTP Request. @param [String, Optional] Username for Basic Auth requests. @param [String, Optional] Password for Basic Auth requests.

# File lib/moesif_api/http/http_client.rb, line 101
def delete(query_url,
           headers: nil,
           username: nil,
           password: nil)
  return HttpRequest.new(HttpMethodEnum::DELETE,
                         query_url,
                         headers: headers,
                         username: username,
                         password: password)
end
execute_as_binary(http_request) click to toggle source

Execute an HttpRequest when the response is expected to be binary. @param [HttpRequest] The HttpRequest to be executed.

# File lib/moesif_api/http/http_client.rb, line 13
def execute_as_binary(http_request)
  raise NotImplementedError, "This method needs to be implemented in a child class."
end
execute_as_string(http_request) click to toggle source

Execute an HttpRequest when the response is expected to be a string. @param [HttpRequest] The HttpRequest to be executed.

# File lib/moesif_api/http/http_client.rb, line 7
def execute_as_string(http_request)
  raise NotImplementedError, "This method needs to be implemented in a child class."
end
get(query_url, headers: nil, username: nil, password: nil) click to toggle source

Get a GET HttpRequest object. @param [String] The URL to send the request to. @param [Hash, Optional] The headers for the HTTP Request. @param [String, Optional] Username for Basic Auth requests. @param [String, Optional] Password for Basic Auth requests.

# File lib/moesif_api/http/http_client.rb, line 28
def get(query_url,
        headers: nil,
        username: nil,
        password: nil)
  return HttpRequest.new(HttpMethodEnum::GET,
                         query_url,
                         headers: headers,
                         username: username,
                         password: password)
end
patch(query_url, headers: nil, parameters: nil, username: nil, password: nil) click to toggle source

Get a PATCH HttpRequest object. @param [String] The URL to send the request to. @param [Hash, Optional] The headers for the HTTP Request. @param [Hash, Optional] The parameters for the HTTP Request. @param [String, Optional] Username for Basic Auth requests. @param [String, Optional] Password for Basic Auth requests.

# File lib/moesif_api/http/http_client.rb, line 83
def patch(query_url,
          headers: nil,
          parameters: nil,
          username: nil,
          password: nil)
  return HttpRequest.new(HttpMethodEnum::PATCH,
                         query_url,
                         headers: headers,
                         parameters: parameters,
                         username: username,
                         password: password)
end
post(query_url, headers: nil, parameters: nil, username: nil, password: nil) click to toggle source

Get a POST HttpRequest object. @param [String] The URL to send the request to. @param [Hash, Optional] The headers for the HTTP Request. @param [Hash, Optional] The parameters for the HTTP Request. @param [String, Optional] Username for Basic Auth requests. @param [String, Optional] Password for Basic Auth requests.

# File lib/moesif_api/http/http_client.rb, line 45
def post(query_url,
         headers: nil,
         parameters: nil,
         username: nil,
         password: nil)
  return HttpRequest.new(HttpMethodEnum::POST,
                         query_url,
                         headers: headers,
                         parameters: parameters,
                         username: username,
                         password: password)
end
put(query_url, headers: nil, parameters: nil, username: nil, password: nil) click to toggle source

Get a PUT HttpRequest object. @param [String] The URL to send the request to. @param [Hash, Optional] The headers for the HTTP Request. @param [Hash, Optional] The parameters for the HTTP Request. @param [String, Optional] Username for Basic Auth requests. @param [String, Optional] Password for Basic Auth requests.

# File lib/moesif_api/http/http_client.rb, line 64
def put(query_url,
        headers: nil,
        parameters: nil,
        username: nil,
        password: nil)
  return HttpRequest.new(HttpMethodEnum::PUT,
                         query_url,
                         headers: headers,
                         parameters: parameters,
                         username: username,
                         password: password)
end