Module: Webmaster::Api::Connection

Extended by:
Connection
Included in:
Connection, Base
Defined in:
lib/webmaster/api/connection.rb

Constant Summary collapse

USER_AGENT =
'User-Agent'.freeze
ACCEPT =
'Accept'.freeze
ACCEPT_CHARSET =
'Accept-Charset'.freeze
CONTENT_TYPE =
'Content-Type'.freeze
ALLOWED_OPTIONS =
[
  :headers,
  :url,
  :params,
  :request,
  :ssl
].freeze

Instance Method Summary collapse

Instance Method Details

#connection(options = {}) ⇒ Object

Returns a Fraday::Connection object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/webmaster/api/connection.rb', line 28

def connection(options = {})

  options = self.connection_options(options)
  
  if @connection_options != options        
    @connection = nil
    @connection_options = options          
  end

  @connection ||= Faraday.new(@connection_options.merge(:builder => self.stack))
end