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