Class: Miteru::HTTP::Factory
- Inherits:
-
Object
- Object
- Miteru::HTTP::Factory
- Defined in:
- lib/miteru/http.rb
Overview
HTTP client factory
Constant Summary collapse
Class Method Summary collapse
Class Method Details
.build(headers: {}, timeout: nil, raise_exception: true) ⇒ ::HTTP::Client
39 40 41 42 43 44 45 46 47 |
# File 'lib/miteru/http.rb', line 39 def build(headers: {}, timeout: nil, raise_exception: true) client = raise_exception ? ::HTTP.use(:better_error) : ::HTTP headers["User-Agent"] ||= USER_AGENT client = client.headers(headers) client = client.timeout(timeout) unless timeout.nil? client end |