lib/proxy_fetcher/client/client.rb in proxy_fetcher-0.6.1 vs lib/proxy_fetcher/client/client.rb in proxy_fetcher-0.6.2

- old
+ new

@@ -1,27 +1,122 @@ module ProxyFetcher + # ProxyFetcher HTTP client that encapsulates all the logic for sending + # HTTP(S) requests using proxies, automatically fetched and validated by the gem. module Client class << self + # Sends HTTP GET request. + # + # @param url [String] + # Requested URL + # + # @param headers [Hash] + # HTTP headers that will be used in the request + # + # @param options [Hash] + # Additional options used by <code>ProxyFetcher::Client</code> + # + # @return [String] + # HTML body from the URL. + # def get(url, headers: {}, options: {}) request_without_payload(:get, url, headers, options) end + # Sends HTTP HEAD request. + # + # @param url [String] + # Requested URL + # + # @param headers [Hash] + # HTTP headers that will be used in the request + # + # @param options [Hash] + # Additional options used by <code>ProxyFetcher::Client</code> + # + # @return [String] + # HTML body from the URL. + # def head(url, headers: {}, options: {}) request_without_payload(:head, url, headers, options) end + # Sends HTTP POST request. + # + # @param url [String] + # Requested URL + # + # @param payload [String, Hash] + # HTTP payload + # + # @param headers [Hash] + # HTTP headers that will be used in the request + # + # @param options [Hash] + # Additional options used by <code>ProxyFetcher::Client</code> + # + # @return [String] + # HTML body from the URL. + # def post(url, payload, headers: {}, options: {}) request_with_payload(:post, url, payload, headers, options) end + # Sends HTTP DELETE request. + # + # @param url [String] + # Requested URL + # + # @param headers [Hash] + # HTTP headers that will be used in the request + # + # @param options [Hash] + # Additional options used by <code>ProxyFetcher::Client</code> + # + # @return [String] + # HTML body from the URL. + # def delete(url, headers: {}, options: {}) request_without_payload(:delete, url, headers, options) end + # Sends HTTP PUT request. + # + # @param url [String] + # Requested URL + # + # @param payload [String, Hash] + # HTTP payload + # + # @param headers [Hash] + # HTTP headers that will be used in the request + # + # @param options [Hash] + # Additional options used by <code>ProxyFetcher::Client</code> + # + # @return [String] + # HTML body from the URL. + # def put(url, payload, headers: {}, options: {}) request_with_payload(:put, url, payload, headers, options) end + # Sends HTTP PATCH request. + # + # @param url [String] + # Requested URL + # + # @param payload [String, Hash] + # HTTP payload + # + # @param headers [Hash] + # HTTP headers that will be used in the request + # + # @param options [Hash] + # Additional options used by <code>ProxyFetcher::Client</code> + # + # @return [String] + # HTML body from the URL. + # def patch(url, payload, headers: {}, options: {}) request_with_payload(:patch, url, payload, headers, options) end private