linkedin-oauth2 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +9 -9
- data/.gitignore +24 -39
- data/.travis.yml +4 -4
- data/.yardopts +2 -0
- data/CHANGELOG.md +10 -0
- data/CONTRIBUTING.md +1 -0
- data/Gemfile +6 -5
- data/LICENSE +19 -17
- data/README.md +399 -0
- data/Rakefile +15 -22
- data/lib/linked_in/access_token.rb +24 -0
- data/lib/linked_in/api.rb +96 -3
- data/lib/linked_in/api_resource.rb +165 -0
- data/lib/linked_in/communications.rb +40 -0
- data/lib/linked_in/companies.rb +146 -0
- data/lib/linked_in/configuration.rb +41 -0
- data/lib/linked_in/connection.rb +31 -0
- data/lib/linked_in/errors.rb +33 -13
- data/lib/linked_in/groups.rb +116 -0
- data/lib/linked_in/jobs.rb +68 -0
- data/lib/linked_in/mash.rb +34 -34
- data/lib/linked_in/oauth2.rb +223 -0
- data/lib/linked_in/people.rb +141 -0
- data/lib/linked_in/search.rb +58 -43
- data/lib/linked_in/share_and_social_stream.rb +128 -0
- data/lib/linked_in/version.rb +1 -9
- data/lib/linkedin-oauth2.rb +43 -25
- data/linkedin-oauth2.gemspec +35 -21
- data/spec/linked_in/api/api_spec.rb +41 -0
- data/spec/linked_in/api/communications_spec.rb +13 -0
- data/spec/linked_in/api/companies_spec.rb +59 -0
- data/spec/linked_in/api/groups_spec.rb +55 -0
- data/spec/linked_in/api/jobs_spec.rb +33 -0
- data/spec/linked_in/api/people_spec.rb +181 -0
- data/spec/linked_in/api/search_spec.rb +71 -0
- data/spec/linked_in/api/share_and_social_stream_spec.rb +60 -0
- data/spec/linked_in/configuration_spec.rb +46 -0
- data/spec/linked_in/connection_spec.rb +10 -0
- data/spec/linked_in/module_loading_spec.rb +23 -0
- data/spec/linked_in/oauth/access_token_spec.rb +27 -0
- data/spec/linked_in/oauth/auth_code_spec.rb +86 -0
- data/spec/linked_in/oauth/credentials_spec.rb +96 -0
- data/spec/linked_in/oauth/get_access_token_spec.rb +108 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/vcr_cassettes/access_token_success.yml +84 -0
- data/spec/vcr_cassettes/bad_code.yml +78 -0
- data/spec/vcr_cassettes/companies_data.yml +44 -0
- data/spec/vcr_cassettes/invalid_access_token.yml +60 -0
- data/spec/vcr_cassettes/not_found.yml +64 -0
- data/spec/vcr_cassettes/people_picture_urls.yml +54 -0
- data/spec/vcr_cassettes/people_profile_connections_fields.yml +73 -0
- data/spec/vcr_cassettes/people_profile_connections_other.yml +78 -0
- data/spec/vcr_cassettes/people_profile_connections_self.yml +78 -0
- data/spec/vcr_cassettes/people_profile_fields_complex.yml +70 -0
- data/spec/vcr_cassettes/people_profile_fields_simple.yml +57 -0
- data/spec/vcr_cassettes/people_profile_lang_spanish.yml +59 -0
- data/spec/vcr_cassettes/people_profile_multiple_fields.yml +68 -0
- data/spec/vcr_cassettes/people_profile_multiple_uids.yml +70 -0
- data/spec/vcr_cassettes/people_profile_multiple_uids_and_urls.yml +76 -0
- data/spec/vcr_cassettes/people_profile_multiple_urls.yml +70 -0
- data/spec/vcr_cassettes/people_profile_new_connections_fields.yml +69 -0
- data/spec/vcr_cassettes/people_profile_new_connections_other.yml +72 -0
- data/spec/vcr_cassettes/people_profile_new_connections_self.yml +72 -0
- data/spec/vcr_cassettes/people_profile_other_uid.yml +59 -0
- data/spec/vcr_cassettes/people_profile_other_url.yml +59 -0
- data/spec/vcr_cassettes/people_profile_own.yml +59 -0
- data/spec/vcr_cassettes/people_profile_own_secure.yml +59 -0
- data/spec/vcr_cassettes/unauthorized.yml +61 -0
- data/spec/vcr_cassettes/unavailable.yml +81 -0
- metadata +145 -88
- data/.autotest +0 -14
- data/.document +0 -5
- data/.gemtest +0 -0
- data/.rspec +0 -1
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/README.markdown +0 -121
- data/changelog.markdown +0 -94
- data/examples/authenticate.rb +0 -16
- data/examples/network.rb +0 -12
- data/examples/profile.rb +0 -18
- data/examples/sinatra.rb +0 -69
- data/examples/status.rb +0 -6
- data/lib/linked_in/api/query_methods.rb +0 -123
- data/lib/linked_in/api/update_methods.rb +0 -76
- data/lib/linked_in/client.rb +0 -31
- data/lib/linked_in/helpers.rb +0 -6
- data/lib/linked_in/helpers/authorization.rb +0 -106
- data/lib/linked_in/helpers/request.rb +0 -93
- data/spec/cases/api_spec.rb +0 -192
- data/spec/cases/linkedin_spec.rb +0 -37
- data/spec/cases/mash_spec.rb +0 -85
- data/spec/cases/oauth_spec.rb +0 -130
- data/spec/cases/search_spec.rb +0 -190
- data/spec/helper.rb +0 -30
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Zjk1YTQ0ZjFjMzIzMDE0M2EzZTNiYTEyMzhlMjMyMTU5NjhjMGM4OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
7
|
-
|
6
|
+
MDAzY2MzZjJhYWJjMWFiMDk2MTRiMGIzZGIxN2U3YTczZWI0Y2Y3ZQ==
|
7
|
+
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDBiOTVhZmU1NmYyYWYzNDRhODQ1ZTk3MzQ2NzY4ZmMwZjM1YmIyOTljNzky
|
10
|
+
MWM4NzhlNWU2NGE5NGRiMjZkOWJiNmE2MzcyNTJlYmQ0ZDBhMTFjMDE5ZTAy
|
11
|
+
NmEyZDhiMzJlMGJlZWFmM2Q3MDM0NmU5OGMyMGZkM2IzMGZiMzg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWJhZDU1N2I1YjYyMGQ5ODJjY2I1NTM5YjI1NDY4N2IwMTk0ZWIwNTQzMjM0
|
14
|
+
Y2FiMmExN2FhOWMwYzNlMWJlMDc1ZjIwMzY2OGUyNGNjNzdiNjg4ODkyNzY1
|
15
|
+
NWNiZTRmNDk3NDY4YzQzMWM3MjBiODJjY2U5ZDlkZjg2NDMzYTk=
|
data/.gitignore
CHANGED
@@ -1,41 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
*.tmproject
|
6
|
-
*.un~
|
7
|
-
*~
|
8
|
-
.DS_Store
|
9
|
-
.Spotlight-V100
|
10
|
-
.Trashes
|
11
|
-
._*
|
12
|
-
.bundle
|
13
|
-
.config
|
14
|
-
.directory
|
15
|
-
.elc
|
16
|
-
.redcar
|
17
|
-
.yardoc
|
18
|
-
.rvmrc
|
19
|
-
/.emacs.desktop
|
20
|
-
/.emacs.desktop.lock
|
21
|
-
Desktop.ini
|
1
|
+
# Only gem-specific ignores are included in this file.
|
2
|
+
# For common .gitignore items, you should set your local ~/.gitignore
|
3
|
+
|
4
|
+
# We want to ignore Gemfile.lock for gems. See http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
|
22
5
|
Gemfile.lock
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
6
|
+
.Gemfile
|
7
|
+
|
8
|
+
# Use your own ~/.rspec
|
9
|
+
# See suggested options in Rakefile
|
10
|
+
.rspec
|
11
|
+
|
12
|
+
# We do not want to lock a ruby version or gemeset to develop on
|
13
|
+
.rvmrc
|
14
|
+
.ruby-gemset
|
15
|
+
.ruby-version
|
16
|
+
|
17
|
+
# Compile yarddoc with the `yard` command
|
18
|
+
.yardoc
|
31
19
|
doc/
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
tmp
|
40
|
-
tmtags
|
41
|
-
tramp
|
20
|
+
|
21
|
+
# Run `rake build` to generate the gem
|
22
|
+
/*.gem
|
23
|
+
pkg/
|
24
|
+
|
25
|
+
# Running coveralls
|
26
|
+
coverage
|
data/.travis.yml
CHANGED
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Read [GitHub's "Contributing to Open Source on GitHub"](https://guides.github.com/activities/contributing-to-open-source/)
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
|
1
|
+
The MIT License
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
3
|
+
Copyright (c) 2014-present Evan Morikawa (evan@evanmorikawa.com) 2013-2014
|
4
|
+
Matt Kirk 2009-11 Wynn Netherland.
|
10
5
|
|
11
|
-
|
12
|
-
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,399 @@
|
|
1
|
+
# LinkedIn OAuth 2.0
|
2
|
+
[![Build Status](https://travis-ci.org/emorikawa/linkedin-oauth2.svg?branch=master)](https://travis-ci.org/emorikawa/linkedin-oauth2)
|
3
|
+
[![Coverage Status](https://coveralls.io/repos/emorikawa/linkedin-oauth2/badge.png)](https://coveralls.io/r/emorikawa/linkedin-oauth2)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/emorikawa/linkedin-oauth2/badges/gpa.svg)](https://codeclimate.com/github/emorikawa/linkedin-oauth2)
|
5
|
+
[![Dependency Status](https://gemnasium.com/emorikawa/linkedin-oauth2.svg)](https://gemnasium.com/emorikawa/linkedin-oauth2)
|
6
|
+
|
7
|
+
OAuth 2.0 Ruby wrapper for the [LinkedIn API](http://developer.linkedin.com).
|
8
|
+
|
9
|
+
If you are using OAuth 1.0, see the [hexgnu/linkedin](https://github.com/hexgnu/linkedin)
|
10
|
+
|
11
|
+
If you are upgrading from the oauth2-v0.1.0 version of this gem, see the
|
12
|
+
[upgrade notes](#upgrading) below.
|
13
|
+
|
14
|
+
# Installation
|
15
|
+
|
16
|
+
In Bundler:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem "linkedin-oauth2", "~> 1.0"
|
20
|
+
```
|
21
|
+
|
22
|
+
Otherwise:
|
23
|
+
|
24
|
+
[sudo|rvm] gem install linkedin-oauth2
|
25
|
+
|
26
|
+
# Usage
|
27
|
+
|
28
|
+
**[Step 1:](#step-1-register-your-application)** [Register](https://www.linkedin.com/secure/developer) your
|
29
|
+
application with LinkedIn. They will give you a **Client ID** (aka API
|
30
|
+
Key) and a **Client Secret** (aka Secret Key)
|
31
|
+
|
32
|
+
**[Step 2:](#step-2-getting-an-access-token)** Use your **Client ID** and **Client Secret** to obtain an **Access Token** from some user.
|
33
|
+
|
34
|
+
**[Step 3:](#step-3-using-linkedins-api)** Use an **Access Token** to query the API.
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
api = LinkedIn::API.new(access_token)
|
38
|
+
me = api.profile
|
39
|
+
```
|
40
|
+
|
41
|
+
## Step 1: Register your Application
|
42
|
+
|
43
|
+
You first need to create and register an application with LinkedIn
|
44
|
+
[here](https://www.linkedin.com/secure/developer).
|
45
|
+
|
46
|
+
You will not be able to use any part of the API without registering first.
|
47
|
+
|
48
|
+
Once you have registered you will need to take note of a few key items on
|
49
|
+
your Application Details page.
|
50
|
+
|
51
|
+
1. **API Key** - We refer to this as your client id or `client_id`
|
52
|
+
1. **Secret Key** - We refer to this as your client secret or
|
53
|
+
`client_secret`
|
54
|
+
1. **Default Scope** - This is the set of permissions you request from
|
55
|
+
users when they connect to your app. If you want to set this on a
|
56
|
+
request-by-request basis, you can use the `scope` option with the
|
57
|
+
`auth_code_url` method.
|
58
|
+
1. **OAuth 2.0 Redirect URLs** - For security reasons, the url you enter
|
59
|
+
in this box must exactly match the `redirect_uri` you use in this gem.
|
60
|
+
|
61
|
+
You do NOT need **OAuth User Token** nor **OAuth User Secret**. That is
|
62
|
+
for OAuth 1.0. This gem is for OAuth 2.0.
|
63
|
+
|
64
|
+
## Step 2: Getting An Access Token
|
65
|
+
|
66
|
+
All LinkedIn API requests must be made in the context of an access token.
|
67
|
+
The access token encodes what LinkedIn information your AwesomeApp® can
|
68
|
+
gather on behalf of "John Doe".
|
69
|
+
|
70
|
+
There are a few different ways to get an access token from a user.
|
71
|
+
|
72
|
+
1. You can use [LinkedIn's Javascript API](https://developer.linkedin.com/documents/javascript-api-reference-0) to authenticate on the front-end and then pass the access token to the backend via [this procedure](https://developer.linkedin.com/documents/exchange-jsapi-tokens-rest-api-oauth-tokens).
|
73
|
+
|
74
|
+
1. If you use OmniAuth, I would recommend looking at [decioferreira/omniauth-linkedin-oauth2](https://github.com/decioferreira/omniauth-linkedin-oauth2) to help automate authentication.
|
75
|
+
|
76
|
+
1. You can do it manually using this linkedin-oauth2 gem and the steps
|
77
|
+
below.
|
78
|
+
|
79
|
+
Here is how to get an access token using this linkedin-oauth2 gem:
|
80
|
+
|
81
|
+
### Step 2A: Configuration
|
82
|
+
|
83
|
+
You will need to configure the following items:
|
84
|
+
|
85
|
+
1. Your **client id** (aka API Key)
|
86
|
+
1. Your **client secret** (aka Secret Key)
|
87
|
+
1. Your **redirect uri**. On LinkedIn's website you must input a list of
|
88
|
+
valid redirect URIs. If you use the same one each time, you can set it
|
89
|
+
in the `LinkedIn.configure` block. If your redirect uris change
|
90
|
+
depending on business logic, you can pass it into the `auth_code_url`
|
91
|
+
method.
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
# It's best practice to keep secret credentials out of source code.
|
95
|
+
# You can, of course, hardcode dev keys or directly pass them in as the
|
96
|
+
# first two arguments of LinkedIn::OAuth2.new
|
97
|
+
LinkedIn.configure do |config|
|
98
|
+
config.client_id = ENV["LINKEDIN_CLIENT_ID"]
|
99
|
+
config.client_secret = ENV["LINKEDIN_CLIENT_SECRET"]
|
100
|
+
|
101
|
+
# This must exactly match the redirect URI you set on your application's
|
102
|
+
# settings page. If your redirect_uri is dynamic, pass it into
|
103
|
+
# `auth_code_url` instead.
|
104
|
+
config.redirect_uri = "https://getawesomeapp.io/linkedin/oauth2"
|
105
|
+
end
|
106
|
+
```
|
107
|
+
|
108
|
+
### Step 2B: Get Auth Code URL
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
oauth = LinkedIn::OAuth2.new
|
112
|
+
|
113
|
+
url = oauth.auth_code_url
|
114
|
+
```
|
115
|
+
|
116
|
+
### Step 2C: User Sign In
|
117
|
+
|
118
|
+
You must now load url from Step 2B in a browser. It will pull up the
|
119
|
+
LinkedIn sign in box. Once LinkedIn user credentials are entered, the box
|
120
|
+
will close and redirect to your redirect url, passing along with it the
|
121
|
+
**OAuth code** as the `code` GET param.
|
122
|
+
|
123
|
+
Be sure to read the extended documentation around the LinkedIn::OAuth2
|
124
|
+
module for more options you can set.
|
125
|
+
|
126
|
+
**Note:** The **OAuth code** only lasts for ~20 seconds!
|
127
|
+
|
128
|
+
### Step 2D: Get Access Token
|
129
|
+
|
130
|
+
```ruby
|
131
|
+
code = "THE_OAUTH_CODE_LINKEDIN_GAVE_ME"
|
132
|
+
|
133
|
+
access_token = oauth.get_access_token(code)
|
134
|
+
```
|
135
|
+
|
136
|
+
Now that you have an access token, you can use it to query the API.
|
137
|
+
|
138
|
+
The `LinkedIn::OAuth2` inherits from [intreda/oauth2](https://github.com/intridea/oauth2)'s `OAuth2::Client` class. See that gem's [documentation](https://github.com/intridea/oauth2/blob/master/lib/oauth2/client.rb) for more usage examples.
|
139
|
+
|
140
|
+
## Step 3: Using LinkedIn's API
|
141
|
+
|
142
|
+
Once you have an access token, you can query LinkedIn's API.
|
143
|
+
|
144
|
+
Your access token encodes the permissions you're allowed to have. See Step
|
145
|
+
2 and [this LinkedIn document](https://developer.linkedin.com/documents/authentication#granting) for how to change the permissions. See each section's documentation on LinkedIn for more information on what permissions get you access to.
|
146
|
+
|
147
|
+
### People
|
148
|
+
|
149
|
+
See the Profiles of yourself and other users. See the connections of
|
150
|
+
yourslef and other users.
|
151
|
+
|
152
|
+
See https://developer.linkedin.com/documents/people
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
api = LinkedIn::API.new(access_token)
|
156
|
+
```
|
157
|
+
|
158
|
+
#### Yourself
|
159
|
+
|
160
|
+
```ruby
|
161
|
+
me = api.profile
|
162
|
+
```
|
163
|
+
|
164
|
+
#### Others
|
165
|
+
|
166
|
+
```ruby
|
167
|
+
evan_morikawa = api.profile("SDmkCxL2ya")
|
168
|
+
evan_morikawa = api.profile(id: "SDmkCxL2ya")
|
169
|
+
evan_morikawa = api.profile(url: "http://www.linkedin.com/in/evanmorikawa")
|
170
|
+
```
|
171
|
+
|
172
|
+
#### Specific Fields
|
173
|
+
|
174
|
+
See [available fields here](https://developer.linkedin.com/documents/profile-fields)
|
175
|
+
|
176
|
+
```ruby
|
177
|
+
my_name = api.profile(fields: ["first-name", "last-name"])
|
178
|
+
my_job_titles = api.profile(fields: ["id", {"positions" => ["title"]}])
|
179
|
+
```
|
180
|
+
|
181
|
+
#### Multiple People
|
182
|
+
|
183
|
+
```ruby
|
184
|
+
me_and_others = api.profile(ids: ["self", "SDmkCxL2ya"])
|
185
|
+
```
|
186
|
+
|
187
|
+
#### Connections
|
188
|
+
|
189
|
+
```ruby
|
190
|
+
# Takes the same arguments as `LinkedIn::API#profile`
|
191
|
+
my_connections = api.connections
|
192
|
+
evans_connections = api.connections(id: "SDmkCxL2ya")
|
193
|
+
```
|
194
|
+
|
195
|
+
#### New Connections
|
196
|
+
|
197
|
+
```ruby
|
198
|
+
# Takes the same options argument as `LinkedIn::API#connections`
|
199
|
+
since = Time.new(2014,1,1)
|
200
|
+
my_new_connections = api.connections(since)
|
201
|
+
evans_new_connections = api.connections(since, id: "SDmkCxL2ya")
|
202
|
+
```
|
203
|
+
|
204
|
+
### People Search
|
205
|
+
|
206
|
+
Search through People
|
207
|
+
|
208
|
+
See https://developer.linkedin.com/documents/people-search-api
|
209
|
+
|
210
|
+
```ruby
|
211
|
+
api.search
|
212
|
+
api.search("Proximate")
|
213
|
+
api.search(keywords: "Proximate Olin")
|
214
|
+
api.search(keywords: "Proximate Olin", start: 10, count: 20)
|
215
|
+
api.search(school_name: "Olin College of Engineering")
|
216
|
+
|
217
|
+
api.search(fields: {facets: ["code", {buckets: ["code", "name"]}] },
|
218
|
+
facets: "location")
|
219
|
+
|
220
|
+
# Identify all 1st degree connections living in the San Francisco Bay Area
|
221
|
+
# See https://developer.linkedin.com/documents/people-search-api#Facets
|
222
|
+
api.search(fields: {facets: ["code", {buckets: ["code", "name", "count"]}]},
|
223
|
+
facets: "location,network",
|
224
|
+
facet: ["location,us:84", "network,F"])
|
225
|
+
```
|
226
|
+
|
227
|
+
### Groups
|
228
|
+
|
229
|
+
Access and interact with LinkedIn Groups
|
230
|
+
|
231
|
+
You need the "rw_groups" permission for most group actions
|
232
|
+
|
233
|
+
See https://developer.linkedin.com/documents/groups
|
234
|
+
|
235
|
+
```ruby
|
236
|
+
# My groups
|
237
|
+
api.group_suggestions
|
238
|
+
api.group_memberships
|
239
|
+
|
240
|
+
# Another group
|
241
|
+
api.group_profile(id: 12345)
|
242
|
+
api.group_posts(id: 12345, count: 10, start: 10)
|
243
|
+
|
244
|
+
# Participate
|
245
|
+
api.add_group_share(12345, title: "Hi")
|
246
|
+
|
247
|
+
api.join_group(12345)
|
248
|
+
```
|
249
|
+
|
250
|
+
### Companies
|
251
|
+
|
252
|
+
Detailed overviews of Company information
|
253
|
+
|
254
|
+
See https://developer.linkedin.com/documents/companies
|
255
|
+
|
256
|
+
```ruby
|
257
|
+
# Company info
|
258
|
+
api.company(name: "google")
|
259
|
+
api.company(id: 12345)
|
260
|
+
api.company_updates(name: "google")
|
261
|
+
api.company_statistics(name: "google")
|
262
|
+
|
263
|
+
# Info on a particular company update
|
264
|
+
api.company_update_comments(1337, name: "google")
|
265
|
+
api.company_update_likes(1337, name: "google")
|
266
|
+
|
267
|
+
# Follow/unfollow
|
268
|
+
api.follow_company(12345)
|
269
|
+
api.unfollow_company(12345)
|
270
|
+
|
271
|
+
# Need rw_company_admin
|
272
|
+
api.add_company_share(12345, content: "Hi")
|
273
|
+
```
|
274
|
+
|
275
|
+
### Jobs
|
276
|
+
|
277
|
+
A search for Jobs on LinkedIn
|
278
|
+
|
279
|
+
See https://developer.linkedin.com/documents/jobs
|
280
|
+
|
281
|
+
```ruby
|
282
|
+
# Find a job
|
283
|
+
api.job(id: 12345)
|
284
|
+
|
285
|
+
# Your jobs
|
286
|
+
api.job_bookmarks
|
287
|
+
api.job_suggestions
|
288
|
+
api.add_job_bookmark(12345)
|
289
|
+
```
|
290
|
+
|
291
|
+
### Share and Social Stream
|
292
|
+
|
293
|
+
View and update content on social streams
|
294
|
+
|
295
|
+
See https://developer.linkedin.com/documents/share-and-social-stream
|
296
|
+
|
297
|
+
```ruby
|
298
|
+
# Your news feed
|
299
|
+
api.network_updates
|
300
|
+
api.shares
|
301
|
+
|
302
|
+
api.add_share(content: "hi")
|
303
|
+
api.update_comment(12345, content: "hi")
|
304
|
+
|
305
|
+
# For a particular feed item
|
306
|
+
api.share_comments(12345)
|
307
|
+
api.share_likes(12345)
|
308
|
+
|
309
|
+
api.like_share(12345)
|
310
|
+
api.unlike_share(12345)
|
311
|
+
```
|
312
|
+
|
313
|
+
### Communications
|
314
|
+
|
315
|
+
Invitations and messages between connections apis
|
316
|
+
|
317
|
+
See https://developer.linkedin.com/documents/communications
|
318
|
+
|
319
|
+
```ruby
|
320
|
+
# Need w_messages permissions
|
321
|
+
|
322
|
+
api.send_message("Subject", "Body", ["user1234", "user3456"])
|
323
|
+
```
|
324
|
+
|
325
|
+
# Documentation
|
326
|
+
|
327
|
+
On [RubyDoc here](http://rubydoc.info/github/emorikawa/linkedin-oauth2/frames/file/README.md)
|
328
|
+
|
329
|
+
Read the source for [LinkedIn::API](https://github.com/emorikawa/linkedin-oauth2/blob/master/lib/linked_in/api.rb) and [LinkedIn::OAuth2](https://github.com/emorikawa/linkedin-oauth2/blob/master/lib/linked_in/oauth2.rb)
|
330
|
+
|
331
|
+
# Upgrading
|
332
|
+
|
333
|
+
v1.0 of linkedin-oauth2 is a near complete re-write of the gem. Its
|
334
|
+
primary goals were to:
|
335
|
+
|
336
|
+
* Better isolate OAuth 2.0 logic
|
337
|
+
* Better documentation around OAuth 2.0
|
338
|
+
* Build on top of [Faraday](https://github.com/lostisland/faraday)
|
339
|
+
* Modularize the API Endpoints
|
340
|
+
* Better cover LinkedIn's vast API & audit deprecated actions
|
341
|
+
* Achieve near perfect test coverage & code quality
|
342
|
+
|
343
|
+
There are two places you may be upgrading from:
|
344
|
+
|
345
|
+
1. oauth2-v0.1 of this linkedin-oauth2 gem
|
346
|
+
2. [hexgnu/linkedin](https://github.com/hexgnu/linkedin) OAuth 1.0 gem
|
347
|
+
|
348
|
+
### From oauth2-v0.1.0 of linkedin-oauth2
|
349
|
+
|
350
|
+
See the [README from oauth2-v0.1](https://github.com/emorikawa/linkedin-oauth2/blob/395540d029156f29d0e53f588feb31f279aa5d70/README.markdown)
|
351
|
+
|
352
|
+
* The OAuth portion has substantially changed. There should be no changes
|
353
|
+
for the signature of API calls or the response hashes
|
354
|
+
* Some of the API calls in the oauth2-v0.1 were actually broken in the
|
355
|
+
initial OAuth2.0 transition. Those have now been fixed.
|
356
|
+
* Instead of a single `LinkedIn::Client` object there are now two separate
|
357
|
+
major objects.
|
358
|
+
|
359
|
+
1. `LinkedIn::OAuth2` for performing authentication
|
360
|
+
1. `LinkedIn::API` for accessing the API
|
361
|
+
|
362
|
+
* Requests used to be done through the `OAuth2::AccessToken` object. Now
|
363
|
+
they are done through `LinkedIn::Connection`, which is a thin subclass of
|
364
|
+
`Faraday::Connection`. This is composed into the main `LinkedIn::API`
|
365
|
+
object.
|
366
|
+
|
367
|
+
### From hexgnu/linkedin OAuth 1.0
|
368
|
+
|
369
|
+
* OAuth 2.0 is substantially different then OAuth 1.0
|
370
|
+
* The actual API methods, arguments, and return values were designed to
|
371
|
+
look the same as hexgnu/linkedin. You should only have to swap out the
|
372
|
+
Authentication and API client construction.
|
373
|
+
* There is no more `consumer` object. Everything in OAuth 2.0 is centered
|
374
|
+
around acquiring an **Access Token**. Use the new `LinkedIn::OAuth2`
|
375
|
+
class to acquire the token.
|
376
|
+
* There is no more single `client` object. The equivalent is the
|
377
|
+
`LinkedIn::API` object. The `LinkedIn::API` object only needs an access
|
378
|
+
token to work
|
379
|
+
* Requests used to be done through an `OAuth::AccessToken` object. Now
|
380
|
+
they are done through `LinkedIn::Connection`, which is a thin subclass of
|
381
|
+
`Faraday::Connection`. This means that you have the full power and
|
382
|
+
method signatures of Faraday at your disposal.
|
383
|
+
|
384
|
+
# Contributing
|
385
|
+
|
386
|
+
Please see [CONTRIBUTING.md](https://github.com/emorikawa/linkedin-oauth2/blob/master/CONTRIBUTING.md) for details.
|
387
|
+
|
388
|
+
# Credits
|
389
|
+
|
390
|
+
* [Evan Morikawa](https://twitter.com/eom) ([emorikawa](https://github.com/emorikawa))
|
391
|
+
* [Matt Kirk](http://matthewkirk.com) ([hexgnu](https://github.com/hexgnu))
|
392
|
+
* [Wynn Netherland](http://wynnetherland.com) ([pengwynn](https://github.com/pengwynn))
|
393
|
+
* Josh Kalderimis ([joshk](https://github.com/joshk))
|
394
|
+
* Erik Michaels-Ober ([sferik](https://github.com/sferik))
|
395
|
+
* And Many More [Contributors](https://github.com/emorikawa/linkedin-oauth2/graphs/contributors)
|
396
|
+
|
397
|
+
# License
|
398
|
+
|
399
|
+
Copyright :copyright: 2014-present [Evan Morikawa](https://twitter.com/e0m) 2013-2014 [Matt Kirk](http://matthewkirk.com/) 2009-11 [Wynn Netherland](http://wynnnetherland.com/) and [contributors](https://github.com/emorikawa/linkedin-oauth2/graphs/contributors). It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file. See [LICENSE](https://github.com/emorikawa/linkedin-oauth2/blob/master/LICENSE) for details.
|