Class: LinkedIn::Connection

Inherits:
Faraday::Connection
  • Object
show all
Defined in:
lib/linked_in/connection.rb

Overview

Used to perform requests against LinkedIn’s API.

Instance Method Summary collapse

Constructor Details

#initialize(url = nil, options = nil, &block) ⇒ Connection

Returns a new instance of Connection.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/linked_in/connection.rb', line 5

def initialize(url=nil, options=nil, &block)

  if url.is_a? Hash
    options = url
    url = options[:url]
  end

  url = default_url if url.nil?

  super url, options, &block

  # We need to use the FlatParamsEncoder so we can pass multiple of
  # the same param to certain endpoints (like the search API).
  self.options.params_encoder = ::Faraday::FlatParamsEncoder

  logger = Logger.new $stderr
  logger.level = Logger::DEBUG
  self.response :logger, logger

  self.response :linkedin_raise_error
end