module Resizing::HttpClientable

Public Instance Methods

handle_faraday_error() { || ... } click to toggle source
# 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) click to toggle source
# File lib/resizing/http_clientable.rb, line 21
def handle_timeout_error error
  raise APIError.new("TimeoutError: #{error.inspect}")
end
http_client() click to toggle source
# File lib/resizing/http_clientable.rb, line 5
def http_client
  @http_client ||= Faraday.new do |builder|
    builder.options[:open_timeout] = config.open_timeout
    builder.options[:timeout] = config.response_timeout
    builder.request :multipart
    builder.request :url_encoded
    builder.adapter Faraday.default_adapter
  end
end