class MoesifApi::HttpClient
Public Instance Methods
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
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 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 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 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
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
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
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