Class: Gitabu::HttpClient
- Inherits:
-
Object
- Object
- Gitabu::HttpClient
- Defined in:
- lib/gitabu/http_client.rb
Overview
Http client that acts as a middleman to the API.
Constant Summary collapse
- NET_HTTP_ERRORS =
[ Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, JSON::ParserError, SocketError ].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(method, uri, body, params, headers, auth, expect) ⇒ HttpClient
constructor
A new instance of HttpClient.
Constructor Details
#initialize(method, uri, body, params, headers, auth, expect) ⇒ HttpClient
Returns a new instance of HttpClient.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gitabu/http_client.rb', line 23 def initialize(method, uri, body, params, headers, auth, expect) @method = method @body = body @headers = headers @auth = auth @url = prepare_uri(uri, params) @expect = expect.nil? ? :json : expect @http = prepare_http @request = prepare_request end |
Class Method Details
.call(method:, uri:, body: nil, params: nil, headers: nil, auth: nil, expect: nil) ⇒ Object
19 20 21 |
# File 'lib/gitabu/http_client.rb', line 19 def self.call(method:, uri:, body: nil, params: nil, headers: nil, auth: nil, expect: nil) new(method, uri, body, params, headers, auth, expect).call end |
Instance Method Details
#call ⇒ Object
34 35 36 |
# File 'lib/gitabu/http_client.rb', line 34 def call response end |