Class: EzLinkedin::Client

Inherits:
Object
  • Object
show all
Includes:
Api::QueryMethods, Api::UpdateMethods, Request, Search
Defined in:
lib/ezlinkedin/client.rb

Constant Summary

Constants included from Request

Request::API_PATH, Request::DEFAULT_HEADERS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Search

#search

Methods included from Api::UpdateMethods

#join_group, #post_share

Methods included from Api::QueryMethods

#company, #connections, #group_memberships, #network_updates, #profile

Constructor Details

#initialize(c_key = EzLinkedin.token, c_secret = EzLinkedin.secret, options = {}) ⇒ Client

Returns a new instance of Client.



13
14
15
16
17
18
19
20
21
22
# File 'lib/ezlinkedin/client.rb', line 13

def initialize(c_key=EzLinkedin.token, c_secret=EzLinkedin.secret, options={})
	@consumer_key = c_key
	@consumer_secret = c_secret
	@consumer_options = { site: 'https://api.linkedin.com',
												request_token_path: '/uas/oauth/requestToken',
													access_token_path: '/uas/oauth/accessToken',
													authorize_path: '/uas/oauth/authorize' }
	@consumer_options.merge(options)
	@client = OAuth::Consumer.new(c_key, c_secret, @consumer_options)
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



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

def access_token
  @access_token
end

#clientObject (readonly)

Returns the value of attribute client.



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

def client
  @client
end

#consumer_keyObject (readonly)

Returns the value of attribute consumer_key.



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

def consumer_key
  @consumer_key
end

#consumer_optionsObject

Returns the value of attribute consumer_options.



11
12
13
# File 'lib/ezlinkedin/client.rb', line 11

def consumer_options
  @consumer_options
end

#consumer_secretObject (readonly)

Returns the value of attribute consumer_secret.



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

def consumer_secret
  @consumer_secret
end

Instance Method Details

#authorize(token, token_secret) ⇒ Object

Create and outh access token to make api calls with param: token - the access token obtained from omniauth param: token_secret - the access token secret obtained from omniauth



27
28
29
# File 'lib/ezlinkedin/client.rb', line 27

def authorize(token, token_secret)
	@access_token = OAuth::AccessToken.new(@client, token, token_secret)
end