Class: LinkedIn::Client

Inherits:
Object
  • Object
show all
Includes:
API, Configuration
Defined in:
lib/linkedin/client.rb

Instance Method Summary collapse

Methods included from API

included

Methods included from Configuration

included

Methods included from LinkedIn::Configuration::InstanceConfiguration

#configuration, #reset

Methods included from LinkedIn::Configuration::BaseConfiguration

#config, #configure, #load

Constructor Details

#initialize(**config, &block) ⇒ Client

Returns a new instance of Client.



6
7
8
# File 'lib/linkedin/client.rb', line 6

def initialize(**config, &block)
  configure config, &block
end

Instance Method Details

#connectionObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/linkedin/client.rb', line 14

def connection
  @connection ||= Faraday.new 'https://api.linkedin.com' do |conn|
    conn.request :json
    conn.request :url_encoded
    conn.request :linkedin_credentials, configuration
    conn.request :linkedin_format
    conn.request :linkedin_user_agent

    conn.response :linkedin_errors
    conn.response :mashify
    conn.response :logger, configuration.logger
    conn.response :json, content_type: /\bjson$/

    conn.adapter Faraday.default_adapter
  end
end

#credentialsObject



10
11
12
# File 'lib/linkedin/client.rb', line 10

def credentials
  @credentials ||= Credentials.new configuration
end

#headersObject



31
32
33
# File 'lib/linkedin/client.rb', line 31

def headers
  @headers ||= {}
end

#paramsObject



35
36
37
# File 'lib/linkedin/client.rb', line 35

def params
  @params ||= {}
end