Class: AdsCommon::Http
- Inherits:
-
Object
- Object
- AdsCommon::Http
- Defined in:
- lib/ads_common/http.rb
Constant Summary collapse
- HTTP_READ_TIMEOUT =
HTTP read and open timeouts in seconds.
15 * 60
- HTTP_OPEN_TIMEOUT =
5 * 60
Class Method Summary collapse
-
.get(url, config, headers = nil) ⇒ Object
Performs a get on a URL, using all of the connection options in the client library, returning the response body as a string.
-
.get_response(url, config, headers = nil) ⇒ Object
Performs a get on a URL, using all of the connection options in the client library, returning a HTTPI::Response.
-
.post(url, data, config, headers = nil) ⇒ Object
Performs a post on a URL, using all of the connection options in the client library, returning the response body as a string.
-
.post_response(url, data, config, headers = nil) ⇒ Object
Performs a post on a URL, using all of the connection options in the client library, returning a HTTPI::Response.
Class Method Details
.get(url, config, headers = nil) ⇒ Object
Performs a get on a URL, using all of the connection options in the client library, returning the response body as a string.
44 45 46 |
# File 'lib/ads_common/http.rb', line 44 def self.get(url, config, headers = nil) return get_response(url, config, headers).body end |
.get_response(url, config, headers = nil) ⇒ Object
Performs a get on a URL, using all of the connection options in the client library, returning a HTTPI::Response.
36 37 38 39 40 |
# File 'lib/ads_common/http.rb', line 36 def self.get_response(url, config, headers = nil) request = prepare_request(url, config, headers) response = HTTPI.get(request) return response end |
.post(url, data, config, headers = nil) ⇒ Object
Performs a post on a URL, using all of the connection options in the client library, returning the response body as a string.
57 58 59 |
# File 'lib/ads_common/http.rb', line 57 def self.post(url, data, config, headers = nil) return post_response(url, data, config, headers).body end |
.post_response(url, data, config, headers = nil) ⇒ Object
Performs a post on a URL, using all of the connection options in the client library, returning a HTTPI::Response.
50 51 52 53 |
# File 'lib/ads_common/http.rb', line 50 def self.post_response(url, data, config, headers = nil) request = prepare_request(url, config, headers, data) return HTTPI.post(request) end |