linkedin 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.markdown +26 -24
- data/Rakefile +1 -0
- data/lib/linked_in/api/query_methods.rb +3 -3
- data/lib/linked_in/version.rb +1 -1
- data/linkedin.gemspec +7 -7
- data/spec/cases/api_spec.rb +6 -0
- data/spec/fixtures/cassette_library/LinkedIn_Api/Company_API.yml +50 -42
- data/spec/fixtures/cassette_library/LinkedIn_Client/_authorize_from_request.yml +31 -22
- data/spec/fixtures/cassette_library/LinkedIn_Client/_request_token.yml +31 -22
- data/spec/fixtures/cassette_library/LinkedIn_Client/_request_token/with_a_callback_url.yml +31 -22
- data/spec/fixtures/cassette_library/LinkedIn_Client/_request_token/with_default_options.yml +31 -22
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/by_company_name_option.yml +73 -89
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/by_first_name_and_last_name_options.yml +80 -111
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/by_first_name_and_last_name_options_with_fields.yml +92 -127
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/by_keywords_string_parameter.yml +43 -62
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/by_single_keywords_option.yml +43 -62
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search/by_single_keywords_option_with_pagination.yml +35 -37
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search_company/by_keywords_options_with_fields.yml +222 -25
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search_company/by_keywords_string_parameter.yml +70 -146
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search_company/by_single_keywords_option.yml +70 -146
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search_company/by_single_keywords_option_with_facets_to_return.yml +70 -146
- data/spec/fixtures/cassette_library/LinkedIn_Search/_search_company/by_single_keywords_option_with_pagination.yml +64 -126
- metadata +21 -57
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5552595bdd5a79931bf124e803d6d6ff3a5e1939
|
4
|
+
data.tar.gz: 7dd0706eaf4cdd8d0c79544e5c23f5838c561b5f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9f4b1b612f67887669815943046da41af7a4e9cbf0948a8bbc65ff4cf6ae76027aa16b36fcea8c7edf097ab3798316084d11d89032f2ec0ad568fab9c62110b5
|
7
|
+
data.tar.gz: 2f922908abab564f4e87027b4fce1e74536e9722a7228f270c48eb00f797b29fc206fda30135988fb74ddc334ad78f5eb8a9172050ccd0804346a1ba03a290fe
|
data/README.markdown
CHANGED
@@ -14,39 +14,41 @@ Travis CI : [![Build Status](https://secure.travis-ci.org/pengwynn/linkedin.png)
|
|
14
14
|
|
15
15
|
LinkedIn's API uses Oauth for authentication. Luckily, the LinkedIn gem hides most of the gory details from you.
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
```ruby
|
18
|
+
require 'rubygems'
|
19
|
+
require 'linkedin'
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
# get your api keys at https://www.linkedin.com/secure/developer
|
22
|
+
client = LinkedIn::Client.new('your_consumer_key', 'your_consumer_secret')
|
23
|
+
rtoken = client.request_token.token
|
24
|
+
rsecret = client.request_token.secret
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
# to test from your desktop, open the following url in your browser
|
27
|
+
# and record the pin it gives you
|
28
|
+
client.request_token.authorize_url
|
29
|
+
=> "https://api.linkedin.com/uas/oauth/authorize?oauth_token=<generated_token>"
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
# then fetch your access keys
|
32
|
+
client.authorize_from_request(rtoken, rsecret, pin)
|
33
|
+
=> ["OU812", "8675309"] # <= save these for future requests
|
33
34
|
|
34
|
-
|
35
|
-
|
35
|
+
# or authorize from previously fetched access keys
|
36
|
+
client.authorize_from_access("OU812", "8675309")
|
36
37
|
|
37
|
-
|
38
|
+
# you're now free to move about the cabin, call any API method
|
39
|
+
```
|
38
40
|
|
39
41
|
### Profile examples
|
42
|
+
```ruby
|
43
|
+
# get the profile for the authenticated user
|
44
|
+
client.profile
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
# get a profile for someone found in network via ID
|
45
|
-
client.profile(:id => 'gNma67_AdI')
|
46
|
-
|
47
|
-
# get a profile for someone via their public profile url
|
48
|
-
client.profile(:url => 'http://www.linkedin.com/in/netherland')
|
46
|
+
# get a profile for someone found in network via ID
|
47
|
+
client.profile(:id => 'gNma67_AdI')
|
49
48
|
|
49
|
+
# get a profile for someone via their public profile url
|
50
|
+
client.profile(:url => 'http://www.linkedin.com/in/netherland')
|
51
|
+
```
|
50
52
|
|
51
53
|
|
52
54
|
More examples in the [examples folder](http://github.com/pengwynn/linkedin/blob/master/examples).
|
data/Rakefile
CHANGED
@@ -44,8 +44,8 @@ module LinkedIn
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def shares(options={})
|
47
|
-
path = "#{person_path(options)}/network/updates
|
48
|
-
simple_query(path, options)
|
47
|
+
path = "#{person_path(options)}/network/updates"
|
48
|
+
simple_query(path, {:type => "SHAR", :scope => "self"}.merge(options))
|
49
49
|
end
|
50
50
|
|
51
51
|
def share_comments(update_key, options={})
|
@@ -89,7 +89,7 @@ module LinkedIn
|
|
89
89
|
|
90
90
|
def company_path(options)
|
91
91
|
path = "/companies"
|
92
|
-
|
92
|
+
|
93
93
|
if domain = options.delete(:domain)
|
94
94
|
path += "?email-domain=#{CGI.escape(domain)}"
|
95
95
|
elsif id = options.delete(:id)
|
data/lib/linked_in/version.rb
CHANGED
data/linkedin.gemspec
CHANGED
@@ -5,13 +5,13 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.add_dependency 'hashie', ['>= 1.2', '< 2.1']
|
6
6
|
gem.add_dependency 'multi_json', '~> 1.0'
|
7
7
|
gem.add_dependency 'oauth', '~> 0.4'
|
8
|
-
gem.add_development_dependency 'json', '~> 1.6'
|
9
|
-
gem.add_development_dependency 'rake', '~>
|
10
|
-
gem.add_development_dependency 'rdoc', '~>
|
11
|
-
gem.add_development_dependency 'rspec', '~> 2.
|
12
|
-
gem.add_development_dependency 'simplecov', '~> 0.
|
13
|
-
gem.add_development_dependency 'vcr', '~>
|
14
|
-
gem.add_development_dependency 'webmock', '~> 1.
|
8
|
+
# gem.add_development_dependency 'json', '~> 1.6'
|
9
|
+
gem.add_development_dependency 'rake', '~> 10'
|
10
|
+
gem.add_development_dependency 'rdoc', '~> 4.0'
|
11
|
+
gem.add_development_dependency 'rspec', '~> 2.13'
|
12
|
+
gem.add_development_dependency 'simplecov', '~> 0.7'
|
13
|
+
gem.add_development_dependency 'vcr', '~> 2.5'
|
14
|
+
gem.add_development_dependency 'webmock', '~> 1.11'
|
15
15
|
gem.authors = ["Wynn Netherland", "Josh Kalderimis"]
|
16
16
|
gem.description = %q{Ruby wrapper for the LinkedIn API}
|
17
17
|
gem.email = ['wynn.netherland@gmail.com', 'josh.kalderimis@gmail.com']
|
data/spec/cases/api_spec.rb
CHANGED
@@ -63,6 +63,12 @@ describe LinkedIn::Api do
|
|
63
63
|
response.code.should == "201"
|
64
64
|
end
|
65
65
|
|
66
|
+
it "returns the shares for a person" do
|
67
|
+
stub_request(:get, "https://api.linkedin.com/v1/people/~/network/updates?type=SHAR&scope=self&after=1234&count=35").to_return(
|
68
|
+
:body => "{}")
|
69
|
+
client.shares(:after => 1234, :count => 35)
|
70
|
+
end
|
71
|
+
|
66
72
|
it "should be able to comment on network update" do
|
67
73
|
stub_request(:post, "https://api.linkedin.com/v1/people/~/network/updates/key=SOMEKEY/update-comments").to_return(
|
68
74
|
:body => "", :status => 201)
|
@@ -1,73 +1,81 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: https://api.linkedin.com
|
6
|
-
body:
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.linkedin.com/v1/companies/id=1586
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
7
9
|
headers:
|
8
|
-
|
10
|
+
X-Li-Format:
|
9
11
|
- json
|
10
|
-
|
12
|
+
User-Agent:
|
11
13
|
- OAuth gem v0.4.5
|
12
|
-
|
13
|
-
- OAuth oauth_consumer_key="consumer_key",
|
14
|
-
oauth_nonce="nonce", oauth_signature="signature",
|
14
|
+
Authorization:
|
15
|
+
- OAuth oauth_consumer_key="consumer_key", oauth_nonce="nonce", oauth_signature="signature",
|
15
16
|
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1319129843", oauth_token="token",
|
16
17
|
oauth_version="1.0"
|
17
|
-
response:
|
18
|
-
status:
|
18
|
+
response:
|
19
|
+
status:
|
19
20
|
code: 200
|
20
21
|
message: OK
|
21
22
|
headers:
|
22
|
-
|
23
|
+
Server:
|
23
24
|
- Apache-Coyote/1.1
|
24
|
-
|
25
|
+
Vary:
|
25
26
|
- ! '*'
|
26
|
-
|
27
|
+
X-Li-Format:
|
27
28
|
- json
|
28
|
-
|
29
|
+
Content-Type:
|
29
30
|
- application/json;charset=UTF-8
|
30
|
-
|
31
|
+
Transfer-Encoding:
|
31
32
|
- chunked
|
32
|
-
|
33
|
+
Date:
|
33
34
|
- Thu, 20 Oct 2011 16:57:24 GMT
|
34
|
-
body:
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: ! "{\n \"id\": 1586,\n \"name\": \"Amazon\"\n}"
|
35
38
|
http_version: '1.1'
|
36
|
-
|
37
|
-
|
38
|
-
method:
|
39
|
-
uri: https://api.linkedin.com
|
40
|
-
body:
|
39
|
+
recorded_at: Wed, 10 Apr 2013 22:06:51 GMT
|
40
|
+
- request:
|
41
|
+
method: get
|
42
|
+
uri: https://api.linkedin.com/v1/companies/id=1586:(id,name,industry,locations:(address:(city,state,country-code),is-headquarters),employee-count-range)
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: ''
|
41
46
|
headers:
|
42
|
-
|
47
|
+
X-Li-Format:
|
43
48
|
- json
|
44
|
-
|
49
|
+
User-Agent:
|
45
50
|
- OAuth gem v0.4.5
|
46
|
-
|
47
|
-
- OAuth oauth_consumer_key="consumer_key",
|
48
|
-
oauth_nonce="nonc", oauth_signature="signature",
|
51
|
+
Authorization:
|
52
|
+
- OAuth oauth_consumer_key="consumer_key", oauth_nonce="nonc", oauth_signature="signature",
|
49
53
|
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1319129844", oauth_token="token",
|
50
54
|
oauth_version="1.0"
|
51
|
-
response:
|
52
|
-
status:
|
55
|
+
response:
|
56
|
+
status:
|
53
57
|
code: 200
|
54
58
|
message: OK
|
55
59
|
headers:
|
56
|
-
|
60
|
+
Server:
|
57
61
|
- Apache-Coyote/1.1
|
58
|
-
|
62
|
+
Vary:
|
59
63
|
- ! '*'
|
60
|
-
|
64
|
+
X-Li-Format:
|
61
65
|
- json
|
62
|
-
|
66
|
+
Content-Type:
|
63
67
|
- application/json;charset=UTF-8
|
64
|
-
|
68
|
+
Transfer-Encoding:
|
65
69
|
- chunked
|
66
|
-
|
70
|
+
Date:
|
67
71
|
- Thu, 20 Oct 2011 16:57:24 GMT
|
68
|
-
body:
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
72
|
+
body:
|
73
|
+
encoding: UTF-8
|
74
|
+
string: ! "{\n \"employeeCountRange\": {\n \"code\": \"I\",\n \"name\":
|
75
|
+
\"10001+\"\n },\n \"id\": 1586,\n \"industry\": \"Internet\",\n \"locations\":
|
76
|
+
{\n \"_total\": 1,\n \"values\": [{\n \"address\": {\n \"city\":
|
77
|
+
\"Seattle\",\n \"countryCode\": \"us\",\n \"state\": \"WA\"\n },\n
|
78
|
+
\ \"isHeadquarters\": true\n }]\n },\n \"name\": \"Amazon\"\n}"
|
73
79
|
http_version: '1.1'
|
80
|
+
recorded_at: Wed, 10 Apr 2013 22:06:51 GMT
|
81
|
+
recorded_with: VCR 2.5.0
|
@@ -1,28 +1,37 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: https://api.linkedin.com
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.linkedin.com/uas/oauth/accessToken
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
9
11
|
- OAuth gem v0.4.4
|
10
|
-
|
11
|
-
- OAuth oauth_body_hash="2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D", oauth_consumer_key="eAI15DqRUTTd7OuQJBG3Mo0aw2Ekx5yoLX3x3NaLnbTnZbaU46OEii7uNTKijII4",
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
Authorization:
|
13
|
+
- OAuth oauth_body_hash="2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D", oauth_consumer_key="eAI15DqRUTTd7OuQJBG3Mo0aw2Ekx5yoLX3x3NaLnbTnZbaU46OEii7uNTKijII4",
|
14
|
+
oauth_nonce="ztYyddIoKJ8flDjBJyveOSqm96CLaEM4QpOC0CSW0E", oauth_signature="NSp3ZDtycelP7wsDM7dsuDTZGys%3D",
|
15
|
+
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1297095033", oauth_token="2f5b42dd-1e0e-4f8f-a03c-1e510bde5935",
|
16
|
+
oauth_verifier="25038", oauth_version="1.0"
|
17
|
+
Content-Length:
|
18
|
+
- '0'
|
19
|
+
response:
|
20
|
+
status:
|
16
21
|
code: 200
|
17
22
|
message: OK
|
18
|
-
headers:
|
19
|
-
|
23
|
+
headers:
|
24
|
+
Content-Type:
|
20
25
|
- text/plain
|
21
|
-
|
26
|
+
Server:
|
22
27
|
- Apache-Coyote/1.1
|
23
|
-
|
28
|
+
Date:
|
24
29
|
- Mon, 07 Feb 2011 16:10:34 GMT
|
25
|
-
|
26
|
-
-
|
27
|
-
body:
|
28
|
-
|
30
|
+
Content-Length:
|
31
|
+
- '156'
|
32
|
+
body:
|
33
|
+
encoding: UTF-8
|
34
|
+
string: oauth_token=28774cd4-fbe1-4e6e-a05e-1243f6471933&oauth_token_secret=2fafe259-976e-41ad-a6f5-d26bbba42923&oauth_expires_in=0&oauth_authorization_expires_in=0
|
35
|
+
http_version: '1.1'
|
36
|
+
recorded_at: Wed, 10 Apr 2013 22:06:51 GMT
|
37
|
+
recorded_with: VCR 2.5.0
|
@@ -1,28 +1,37 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: https://api.linkedin.com
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.linkedin.com/uas/oauth/requestToken
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
9
11
|
- OAuth gem v0.4.4
|
10
|
-
|
11
|
-
- OAuth oauth_body_hash="2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D", oauth_callback="oob",
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
Authorization:
|
13
|
+
- OAuth oauth_body_hash="2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D", oauth_callback="oob",
|
14
|
+
oauth_consumer_key="eAI15DqRUTTd7OuQJBG3Mo0aw2Ekx5yoLX3x3NaLnbTnZbaU46OEii7uNTKijII4",
|
15
|
+
oauth_nonce="jSQpxoXaoTl2e0dALgc7VKzRJE993wqzRWuXuF0H0", oauth_signature="wn%2Bw0Jvyb9TQ4DC8sq3CxWMDM7Y%3D",
|
16
|
+
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1297093507", oauth_version="1.0"
|
17
|
+
Content-Length:
|
18
|
+
- '0'
|
19
|
+
response:
|
20
|
+
status:
|
16
21
|
code: 200
|
17
22
|
message: OK
|
18
|
-
headers:
|
19
|
-
|
23
|
+
headers:
|
24
|
+
Content-Type:
|
20
25
|
- text/plain
|
21
|
-
|
26
|
+
Server:
|
22
27
|
- Apache-Coyote/1.1
|
23
|
-
|
28
|
+
Date:
|
24
29
|
- Mon, 07 Feb 2011 15:45:08 GMT
|
25
|
-
|
26
|
-
-
|
27
|
-
body:
|
28
|
-
|
30
|
+
Content-Length:
|
31
|
+
- '236'
|
32
|
+
body:
|
33
|
+
encoding: UTF-8
|
34
|
+
string: oauth_token=95f8619b-7069-433b-ac9e-35dfba02b0f7&oauth_token_secret=dffd7996-6943-48ce-be6b-771e86b10f92&oauth_callback_confirmed=true&xoauth_request_auth_url=https%3A%2F%2Fapi.linkedin.com%2Fuas%2Foauth%2Fauthorize&oauth_expires_in=599
|
35
|
+
http_version: '1.1'
|
36
|
+
recorded_at: Wed, 10 Apr 2013 22:06:51 GMT
|
37
|
+
recorded_with: VCR 2.5.0
|
@@ -1,28 +1,37 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: https://api.linkedin.com
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.linkedin.com/uas/oauth/requestToken
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
9
11
|
- OAuth gem v0.4.4
|
10
|
-
|
11
|
-
- OAuth oauth_body_hash="2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D", oauth_callback="http%3A%2F%2Fwww.josh.com",
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
Authorization:
|
13
|
+
- OAuth oauth_body_hash="2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D", oauth_callback="http%3A%2F%2Fwww.josh.com",
|
14
|
+
oauth_consumer_key="eAI15DqRUTTd7OuQJBG3Mo0aw2Ekx5yoLX3x3NaLnbTnZbaU46OEii7uNTKijII4",
|
15
|
+
oauth_nonce="OYVkd4yi5oe16NGQMbANhBB8cabeynkTX28fOEjG1rs", oauth_signature="%2BwgZ8nb2CM5oWRpJEC5U0554uGk%3D",
|
16
|
+
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1297103790", oauth_version="1.0"
|
17
|
+
Content-Length:
|
18
|
+
- '0'
|
19
|
+
response:
|
20
|
+
status:
|
16
21
|
code: 200
|
17
22
|
message: OK
|
18
|
-
headers:
|
19
|
-
|
23
|
+
headers:
|
24
|
+
Content-Type:
|
20
25
|
- text/plain
|
21
|
-
|
26
|
+
Server:
|
22
27
|
- Apache-Coyote/1.1
|
23
|
-
|
28
|
+
Date:
|
24
29
|
- Mon, 07 Feb 2011 18:36:30 GMT
|
25
|
-
|
26
|
-
-
|
27
|
-
body:
|
28
|
-
|
30
|
+
Content-Length:
|
31
|
+
- '236'
|
32
|
+
body:
|
33
|
+
encoding: UTF-8
|
34
|
+
string: oauth_token=f8af7ca2-ca1a-48f2-be6a-bd7b721e2868&oauth_token_secret=c5ec7928-7740-4813-a202-2be8800a0b32&oauth_callback_confirmed=true&xoauth_request_auth_url=https%3A%2F%2Fapi.linkedin.com%2Fuas%2Foauth%2Fauthorize&oauth_expires_in=599
|
35
|
+
http_version: '1.1'
|
36
|
+
recorded_at: Wed, 10 Apr 2013 22:06:51 GMT
|
37
|
+
recorded_with: VCR 2.5.0
|