linkedin 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -4
- data/README.markdown +1 -1
- data/lib/linked_in/api/query_methods.rb +34 -1
- data/lib/linked_in/api/update_methods.rb +17 -0
- data/lib/linked_in/version.rb +1 -1
- data/spec/cases/api_spec.rb +59 -0
- metadata +4 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfe7308054e4ded9f8fabfdbfc04ee68eae04257
|
4
|
+
data.tar.gz: 446b1003b220d412dcd323fa7b5a5ebefa689713
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3459938df6bee5b3e97434b626a55a790778a02017b09fc1ca761ec2a39088c82f15a992eb65b77fc81c3170bbf900d3bfd1527ded889fb45480c2d6dec67529
|
7
|
+
data.tar.gz: ac1f9808e63d3830562f24905d20a82fed94df13795ccf7c4e51b80c6066fe1ca58f1a8618d3aa8ae8e7a2b3300350dc21ed2acebcc1fff0727b7a9668602539
|
data/.travis.yml
CHANGED
data/README.markdown
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Ruby wrapper for the [LinkedIn API](http://developer.linkedin.com). Heavily inspired by [John Nunemaker's](http://github.com/jnunemaker) [Twitter gem](http://github.com/jnunemaker/twitter), the LinkedIn gem provides an easy-to-use wrapper for LinkedIn's Oauth/XML APIs.
|
4
4
|
|
5
|
-
Travis CI : [![Build Status](https://secure.travis-ci.org/
|
5
|
+
Travis CI : [![Build Status](https://secure.travis-ci.org/hexgnu/linkedin.png)](http://travis-ci.org/hexgnu/linkedin)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -23,6 +23,26 @@ module LinkedIn
|
|
23
23
|
simple_query(path, options)
|
24
24
|
end
|
25
25
|
|
26
|
+
def company_updates(options={})
|
27
|
+
path = "#{company_path(options)}/updates"
|
28
|
+
simple_query(path, options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def company_statistics(options={})
|
32
|
+
path = "#{company_path(options)}/company-statistics"
|
33
|
+
simple_query(path, options)
|
34
|
+
end
|
35
|
+
|
36
|
+
def company_updates_comments(update_key, options={})
|
37
|
+
path = "#{company_path(options)}/updates/key=#{update_key}/update-comments"
|
38
|
+
simple_query(path, options)
|
39
|
+
end
|
40
|
+
|
41
|
+
def company_updates_likes(update_key, options={})
|
42
|
+
path = "#{company_path(options)}/updates/key=#{update_key}/likes"
|
43
|
+
simple_query(path, options)
|
44
|
+
end
|
45
|
+
|
26
46
|
def job(options = {})
|
27
47
|
path = jobs_path(options)
|
28
48
|
simple_query(path, options)
|
@@ -67,6 +87,12 @@ module LinkedIn
|
|
67
87
|
path = "#{person_path(options)}/network/updates/key=#{update_key}/likes"
|
68
88
|
simple_query(path, options)
|
69
89
|
end
|
90
|
+
|
91
|
+
def picture_urls(options={})
|
92
|
+
picture_size = options.delete(:picture_size) || 'original'
|
93
|
+
path = "#{picture_urls_path(options)}::(#{picture_size})"
|
94
|
+
simple_query(path, options)
|
95
|
+
end
|
70
96
|
|
71
97
|
private
|
72
98
|
|
@@ -88,7 +114,7 @@ module LinkedIn
|
|
88
114
|
|
89
115
|
headers = options.delete(:headers) || {}
|
90
116
|
params = to_query(options)
|
91
|
-
path += "
|
117
|
+
path += "#{path.include?("?") ? "&" : "?"}#{params}" if !params.empty?
|
92
118
|
|
93
119
|
Mash.from_json(get(path, headers))
|
94
120
|
end
|
@@ -115,11 +141,18 @@ module LinkedIn
|
|
115
141
|
path += "/url=#{CGI.escape(url)}"
|
116
142
|
elsif name = options.delete(:name)
|
117
143
|
path += "/universal-name=#{CGI.escape(name)}"
|
144
|
+
elsif is_admin = options.delete(:is_admin)
|
145
|
+
path += "?is-company-admin=#{CGI.escape(is_admin)}"
|
118
146
|
else
|
119
147
|
path += "/~"
|
120
148
|
end
|
121
149
|
end
|
122
150
|
|
151
|
+
def picture_urls_path(options)
|
152
|
+
path = person_path(options)
|
153
|
+
path += "/picture-urls"
|
154
|
+
end
|
155
|
+
|
123
156
|
def jobs_path(options)
|
124
157
|
path = "/jobs"
|
125
158
|
if id = options.delete(:id)
|
@@ -9,6 +9,23 @@ module LinkedIn
|
|
9
9
|
post(path, defaults.merge(share).to_json, "Content-Type" => "application/json")
|
10
10
|
end
|
11
11
|
|
12
|
+
def add_company_share(company_id, share)
|
13
|
+
path = "/companies/#{company_id}/shares"
|
14
|
+
defaults = {:visibility => {:code => "anyone"}}
|
15
|
+
post(path, defaults.merge(share).to_json, "Content-Type" => "application/json")
|
16
|
+
end
|
17
|
+
|
18
|
+
def follow_company(company_id)
|
19
|
+
path = "/people/~/following/companies"
|
20
|
+
body = {:id => company_id }
|
21
|
+
post(path, body.to_json, "Content-Type" => "application/json")
|
22
|
+
end
|
23
|
+
|
24
|
+
def unfollow_company(company_id)
|
25
|
+
path = "/people/~/following/companies/id=#{company_id}"
|
26
|
+
delete(path)
|
27
|
+
end
|
28
|
+
|
12
29
|
def join_group(group_id)
|
13
30
|
path = "/people/~/group-memberships/#{group_id}"
|
14
31
|
body = {'membership-state' => {'code' => 'member' }}
|
data/lib/linked_in/version.rb
CHANGED
data/spec/cases/api_spec.rb
CHANGED
@@ -19,6 +19,11 @@ describe LinkedIn::Api do
|
|
19
19
|
stub_request(:get, "https://api.linkedin.com/v1/people/id=123").to_return(:body => "{}")
|
20
20
|
client.profile(:id => 123).should be_an_instance_of(LinkedIn::Mash)
|
21
21
|
end
|
22
|
+
|
23
|
+
it "should be able to view the picture urls" do
|
24
|
+
stub_request(:get, "https://api.linkedin.com/v1/people/~/picture-urls::(original)").to_return(:body => "{}")
|
25
|
+
client.picture_urls.should be_an_instance_of(LinkedIn::Mash)
|
26
|
+
end
|
22
27
|
|
23
28
|
it "should be able to view connections" do
|
24
29
|
stub_request(:get, "https://api.linkedin.com/v1/people/~/connections").to_return(:body => "{}")
|
@@ -63,6 +68,13 @@ describe LinkedIn::Api do
|
|
63
68
|
response.code.should == "201"
|
64
69
|
end
|
65
70
|
|
71
|
+
it "should be able to share a new company status" do
|
72
|
+
stub_request(:post, "https://api.linkedin.com/v1/companies/123456/shares").to_return(:body => "", :status => 201)
|
73
|
+
response = client.add_company_share("123456", { :comment => "Testing, 1, 2, 3" })
|
74
|
+
response.body.should == nil
|
75
|
+
response.code.should == "201"
|
76
|
+
end
|
77
|
+
|
66
78
|
it "returns the shares for a person" do
|
67
79
|
stub_request(:get, "https://api.linkedin.com/v1/people/~/network/updates?type=SHAR&scope=self&after=1234&count=35").to_return(
|
68
80
|
:body => "{}")
|
@@ -129,6 +141,16 @@ describe LinkedIn::Api do
|
|
129
141
|
client.company(:domain => 'acme.com').should be_an_instance_of(LinkedIn::Mash)
|
130
142
|
end
|
131
143
|
|
144
|
+
it "should be able to view a user's company pages" do
|
145
|
+
stub_request(:get, "https://api.linkedin.com/v1/companies?is-company-admin=true").to_return(:body => "{}")
|
146
|
+
client.company(:is_admin => 'true').should be_an_instance_of(LinkedIn::Mash)
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should be able to page a user's company pages" do
|
150
|
+
stub_request(:get, "https://api.linkedin.com/v1/companies?is-company-admin=true&count=10&start=0").to_return(:body => "{}")
|
151
|
+
client.company(:is_admin => 'true', :count => 10, :start => 0).should be_an_instance_of(LinkedIn::Mash)
|
152
|
+
end
|
153
|
+
|
132
154
|
it "should load correct company data" do
|
133
155
|
client.company(:id => 1586).name.should == "Amazon"
|
134
156
|
|
@@ -140,6 +162,43 @@ describe LinkedIn::Api do
|
|
140
162
|
data.locations.all[0].address.city.should == "Seattle"
|
141
163
|
data.locations.all[0].is_headquarters.should == true
|
142
164
|
end
|
165
|
+
|
166
|
+
it "should be able to view company_updates" do
|
167
|
+
stub_request(:get, "https://api.linkedin.com/v1/companies/id=1586/updates").to_return(:body => "{}")
|
168
|
+
client.company_updates(:id => 1586).should be_an_instance_of(LinkedIn::Mash)
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should be able to view company_statistic" do
|
172
|
+
stub_request(:get, "https://api.linkedin.com/v1/companies/id=1586/company-statistics").to_return(:body => "{}")
|
173
|
+
client.company_statistics(:id => 1586).should be_an_instance_of(LinkedIn::Mash)
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should be able to view company updates comments" do
|
177
|
+
stub_request(:get, "https://api.linkedin.com/v1/companies/id=1586/updates/key=company_update_key/update-comments").to_return(:body => "{}")
|
178
|
+
client.company_updates_comments("company_update_key", :id => 1586).should be_an_instance_of(LinkedIn::Mash)
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should be able to view company updates likes" do
|
182
|
+
stub_request(:get, "https://api.linkedin.com/v1/companies/id=1586/updates/key=company_update_key/likes").to_return(:body => "{}")
|
183
|
+
client.company_updates_likes("company_update_key", :id => 1586).should be_an_instance_of(LinkedIn::Mash)
|
184
|
+
end
|
185
|
+
|
186
|
+
it "should be able to follow a company" do
|
187
|
+
stub_request(:post, "https://api.linkedin.com/v1/people/~/following/companies").to_return(:body => "", :status => 201)
|
188
|
+
|
189
|
+
response = client.follow_company(1586)
|
190
|
+
response.body.should == nil
|
191
|
+
response.code.should == "201"
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should be able to unfollow a company" do
|
195
|
+
stub_request(:delete, "https://api.linkedin.com/v1/people/~/following/companies/id=1586").to_return(:body => "", :status => 201)
|
196
|
+
|
197
|
+
response = client.unfollow_company(1586)
|
198
|
+
response.body.should == nil
|
199
|
+
response.code.should == "201"
|
200
|
+
end
|
201
|
+
|
143
202
|
end
|
144
203
|
|
145
204
|
context "Job API" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linkedin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wynn Netherland
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-11-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
@@ -221,30 +221,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
223
|
rubyforge_project:
|
224
|
-
rubygems_version: 2.0.
|
224
|
+
rubygems_version: 2.0.3
|
225
225
|
signing_key:
|
226
226
|
specification_version: 4
|
227
227
|
summary: Ruby wrapper for the LinkedIn API
|
228
|
-
test_files:
|
229
|
-
- spec/cases/api_spec.rb
|
230
|
-
- spec/cases/linkedin_spec.rb
|
231
|
-
- spec/cases/mash_spec.rb
|
232
|
-
- spec/cases/oauth_spec.rb
|
233
|
-
- spec/cases/search_spec.rb
|
234
|
-
- spec/fixtures/cassette_library/LinkedIn_Api/Company_API.yml
|
235
|
-
- spec/fixtures/cassette_library/LinkedIn_Client/_authorize_from_request.yml
|
236
|
-
- spec/fixtures/cassette_library/LinkedIn_Client/_request_token.yml
|
237
|
-
- spec/fixtures/cassette_library/LinkedIn_Client/_request_token/with_a_callback_url.yml
|
238
|
-
- spec/fixtures/cassette_library/LinkedIn_Client/_request_token/with_default_options.yml
|
239
|
-
- spec/fixtures/cassette_library/LinkedIn_Search/_search/by_company_name_option.yml
|
240
|
-
- spec/fixtures/cassette_library/LinkedIn_Search/_search/by_first_name_and_last_name_options.yml
|
241
|
-
- spec/fixtures/cassette_library/LinkedIn_Search/_search/by_first_name_and_last_name_options_with_fields.yml
|
242
|
-
- spec/fixtures/cassette_library/LinkedIn_Search/_search/by_keywords_string_parameter.yml
|
243
|
-
- spec/fixtures/cassette_library/LinkedIn_Search/_search/by_single_keywords_option.yml
|
244
|
-
- spec/fixtures/cassette_library/LinkedIn_Search/_search/by_single_keywords_option_with_pagination.yml
|
245
|
-
- spec/fixtures/cassette_library/LinkedIn_Search/_search_company/by_keywords_options_with_fields.yml
|
246
|
-
- spec/fixtures/cassette_library/LinkedIn_Search/_search_company/by_keywords_string_parameter.yml
|
247
|
-
- spec/fixtures/cassette_library/LinkedIn_Search/_search_company/by_single_keywords_option.yml
|
248
|
-
- spec/fixtures/cassette_library/LinkedIn_Search/_search_company/by_single_keywords_option_with_facets_to_return.yml
|
249
|
-
- spec/fixtures/cassette_library/LinkedIn_Search/_search_company/by_single_keywords_option_with_pagination.yml
|
250
|
-
- spec/helper.rb
|
228
|
+
test_files: []
|