lib/immoscout/api/connection.rb in immoscout-1.3.2 vs lib/immoscout/api/connection.rb in immoscout-1.4.0
- old
+ new
@@ -3,25 +3,24 @@
require 'faraday'
require 'faraday_middleware'
module Immoscout
module Api
+ # A connection builder/handler for reusable connections.
module Connection
- # :reek:FeatureEnvy
def connection
@connection ||= Faraday::Connection.new(url: url) do |builder|
configure_oauth(builder)
- builder.request :multipart
- builder.request :url_encoded
- builder.request :json
- builder.response :follow_redirects
- builder.response :json, content_type: /\bjson$/
- builder.adapter :net_http
+ builder.request :multipart
+ builder.request :url_encoded
+ builder.request :json
+ builder.response :follow_redirects
+ builder.response :json, content_type: /\bjson$/
+ builder.adapter :net_http
end
- @connection
end
- private
+ protected
def configure_oauth(builder)
builder.request(
:oauth,
token: config.oauth_token,