Module: Resizing::HttpClientable
- Included in:
- Client
- Defined in:
- lib/resizing/http_clientable.rb
Instance Method Summary collapse
Instance Method Details
#handle_faraday_error(&block) ⇒ Object
15 16 17 18 19 |
# File 'lib/resizing/http_clientable.rb', line 15 def handle_faraday_error &block yield rescue Faraday::TimeoutError => e handle_timeout_error e end |
#handle_timeout_error(error) ⇒ Object
21 22 23 |
# File 'lib/resizing/http_clientable.rb', line 21 def handle_timeout_error error raise APIError.new("TimeoutError: #{error.inspect}") end |
#http_client ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/resizing/http_clientable.rb', line 5 def http_client @http_client ||= Faraday.new do |builder| builder.[:open_timeout] = config.open_timeout builder.[:timeout] = config.response_timeout builder.request :multipart builder.request :url_encoded builder.adapter Faraday.default_adapter end end |