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.
43 44 45 46 47 |
# File 'lib/go_api_client/http_fetcher.rb', line 43 def initialize(={}) @username = [:username] @password = [:password] @ssl_verify_mode = [:ssl_verify_mode] end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
41 42 43 |
# File 'lib/go_api_client/http_fetcher.rb', line 41 def response @response end |
Instance Method Details
#failure? ⇒ Boolean
76 77 78 |
# File 'lib/go_api_client/http_fetcher.rb', line 76 def failure? !success? end |
#status ⇒ Object
68 69 70 |
# File 'lib/go_api_client/http_fetcher.rb', line 68 def status @response.code.to_i end |
#success? ⇒ Boolean
72 73 74 |
# File 'lib/go_api_client/http_fetcher.rb', line 72 def success? (200..299).include?(status) end |