Skip to content
Browse files

Essentially the initial commit

  • Loading branch information...
0 parents commit e460b371d39d73ac94162c1442e0b8593160ecea @skorks committed
Showing with 94 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +1 −0 .rvmrc
  3. +6 −0 Gemfile
  4. +1 −0 README.md
  5. +1 −0 Rakefile
  6. +9 −0 lib/omniauth-linkedin.rb
  7. +5 −0 lib/omniauth-linkedin/version.rb
  8. +43 −0 lib/omniauth/strategies/linkedin.rb
  9. +23 −0 omniauth-linkedin.gemspec
5 .gitignore
@@ -0,0 +1,5 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
+*.swp
1 .rvmrc
@@ -0,0 +1 @@
+rvm 1.9.2@omniauth-linkedin
6 Gemfile
@@ -0,0 +1,6 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in omniauth-linkedin.gemspec
+gemspec
+
+gem 'omniauth-oauth', :git => 'https://github.com/intridea/omniauth-oauth.git'
1 README.md
@@ -0,0 +1 @@
+TODO....
1 Rakefile
@@ -0,0 +1 @@
+require 'bundler/gem_tasks'
9 lib/omniauth-linkedin.rb
@@ -0,0 +1,9 @@
+require "omniauth-linkedin/version"
+require 'omniauth/strategies/linkedin'
+
+
+module Omniauth

@skorks, Should this (also in version.rb) be OmniAuth? In other words, are modules case sensitive? In other other words, would this cause troublesome problems under certain circumstances?

I'm asking for a friend… :question:

@skorks Owner
skorks added a note

Yeah it should be capitalised properly, I just merged a pull request that fixes it, just need to roll out a new version of the gem, hopefully end of the day today sometime.

Heh, that was my co-worker, @bpaul. We were deliberating about it and I didn't realize that he did that while we were chatting about it. I will say that it's impressive how powerful Github has become. He forked the code, edited the files, and then submitted a pull request, all on the web, all in the time we were chatting about whether it was intentional or not. It's just amazing being a developer these days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ module Linkedin
+ # Your code goes here...
+ end
+end
5 lib/omniauth-linkedin/version.rb
@@ -0,0 +1,5 @@
+module Omniauth
+ module Linkedin
+ VERSION = "0.0.1"
+ end
+end
43 lib/omniauth/strategies/linkedin.rb
@@ -0,0 +1,43 @@
+require 'omniauth/strategies/oauth'
+
+module OmniAuth
+ module Strategies
+ class LinkedIn < OmniAuth::Strategies::OAuth
+ option :name, "linkedin"
+
+ option :client_options, {
+ :site => 'https://api.linkedin.com',
+ :request_token_path => '/uas/oauth/requestToken',
+ :access_token_path => '/uas/oauth/accessToken',
+ :authorize_url => 'https://www.linkedin.com/uas/oauth/authenticate'
+ }
+
+ option :fields, ["id", "first-name", "last-name", "headline", "industry", "picture-url", "public-profile-url"]
+
+ uid{ raw_info['id'] }
+
+ info do
+ {
+ :first_name => raw_info['firstName'],
+ :last_name => raw_info['lastName'],
+ :headline => raw_info['headline'],
+ :image => raw_info['pictureUrl'],
+ :industry => raw_info['industry'],
+ :urls => {
+ 'public_profile' => raw_info['publicProfileUrl']
+ }
+ }
+ end
+
+ extra do
+ { 'raw_info' => raw_info }
+ end
+
+ def raw_info
+ @raw_info ||= MultiJson.decode(access_token.get("/v1/people/~:(#{options.fields.join(',')})?format=json").body)
+ end
+ end
+ end
+end
+
+OmniAuth.config.add_camelization 'linkedin', 'LinkedIn'
23 omniauth-linkedin.gemspec
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "omniauth-linkedin/version"
+
+Gem::Specification.new do |s|
+ s.name = "omniauth-linkedin"
+ s.version = Omniauth::Linkedin::VERSION
+ s.authors = ["Alan Skorkin"]
+ s.email = ["alan@skorks.com"]
+ s.homepage = ""
+ s.summary = %q{LinkedIn strategy for OmniAuth.}
+ s.description = %q{LinkedIn strategy for OmniAuth.}
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+
+ s.add_runtime_dependency 'omniauth-oauth', '1.0.0.beta1'
+
+ s.add_development_dependency 'rspec', '~> 2.6.0'
+ s.add_development_dependency 'rake'
+end

0 comments on commit e460b37

Please sign in to comment.
Something went wrong with that request. Please try again.