A modernized LinkedIn Ruby client.
Add this line to your application's Gemfile:
gem 'linkedin2'
And then execute:
$ bundle
Or install it yourself as:
$ gem install linkedin2
Configure an instance directly with a hash:
client = LinkedIn::Client.new key: <your-key>, secret: <your-secret>,
redirect_uri: <your-callback>, scope: %i(r_basicprofile r_network)
Or configure an instance directly with the configure method:
client = LinkedIn::Client.new
client.configure do |config|
config.key = <your-key>
end
client.key # => <your-key>
Or configure the gem with a hash:
LinkedIn::Client.configure key: <your-key>, secret: <your-secret>, redirect_uri: <your-callback>
client = LinkedIn::Client.new
client.key # => <your-key>
Or configure the gem with a block:
LinkedIn::Client.configure do |config|
config.key = '<your-key>'
end
client = LinkedIn::Client.new
client.key # => <your-key>
Following the LinkedIn Authentication Documentation:
Step 1. Register your application
Create a LinkedIn Account and register an application
Step 2a. Generate Authorization Code by redirecting user to LinkedIn's authorization dialog
# create a client and configure it with your :key, :secret and :redirect_uri. See "Client Configuration" above.
client.authorize_url # => A URI that will take a user to LinkedIn, ask them to login and redirect to the URI that you configured
Step 2b. Request Access Token by exchanging the authorization_code for it
# create a client and configure it with your :key, :secret and :redirect_uri. See "Client Configuration" above.
client.request_access_token '<token-from-response>'
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request