20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/torg_mailru_api.rb', line 20
def connection
raise "No access token" if access_token.nil?
@connection ||= begin
conn = Faraday.new ENDPOINT_URI do |c|
c.use Faraday::Response::RaiseError
c.use :instrumentation
c.response :json, content_type: 'application/json'
c.response :caching, cache, strip_params: access_token unless cache.nil?
c.response :logger, logger unless logger.nil?
c.adapter adapter.nil? ? Faraday.default_adapter : adapter
c.proxy proxy if not proxy.nil?
c. = {
'Accept' => 'application/json',
'Authorization' => access_token
}
end
conn
end
end
|