Class: GoApiClient::HttpFetcher
- Inherits:
-
Object
- Object
- GoApiClient::HttpFetcher
- Defined in:
- lib/go_api_client/http_fetcher.rb
Defined Under Namespace
Classes: ConnectionError, HttpError
Constant Summary collapse
- NET_HTTP_EXCEPTIONS =
[ EOFError, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ECONNRESET, EOFError, Errno::EINVAL, Errno::ETIMEDOUT, Net::HTTPBadResponse, Net::HTTPClientError, Net::HTTPError, Net::HTTPFatalError, Net::HTTPHeaderSyntaxError, Net::HTTPRetriableError, Net::HTTPServerException, Net::ProtocolError, SocketError, Timeout::Error, ]
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(options = {}) ⇒ HttpFetcher
constructor
A new instance of HttpFetcher.
- #status ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ HttpFetcher
Returns a new instance of HttpFetcher.
42 43 44 45 |
# File 'lib/go_api_client/http_fetcher.rb', line 42 def initialize(={}) @username = [:username] @password = [:password] end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
40 41 42 |
# File 'lib/go_api_client/http_fetcher.rb', line 40 def response @response end |
Instance Method Details
#failure? ⇒ Boolean
74 75 76 |
# File 'lib/go_api_client/http_fetcher.rb', line 74 def failure? !success? end |
#status ⇒ Object
66 67 68 |
# File 'lib/go_api_client/http_fetcher.rb', line 66 def status @response.code.to_i end |
#success? ⇒ Boolean
70 71 72 |
# File 'lib/go_api_client/http_fetcher.rb', line 70 def success? (200..299).include?(status) end |