Skip to content

Commit

Permalink
Essentially the initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
skorks committed Oct 26, 2011
0 parents commit e460b37
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
*.gem
.bundle
Gemfile.lock
pkg/*
*.swp
1 change: 1 addition & 0 deletions .rvmrc
@@ -0,0 +1 @@
rvm 1.9.2@omniauth-linkedin
6 changes: 6 additions & 0 deletions 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 change: 1 addition & 0 deletions README.md
@@ -0,0 +1 @@
TODO....
1 change: 1 addition & 0 deletions Rakefile
@@ -0,0 +1 @@
require 'bundler/gem_tasks'
9 changes: 9 additions & 0 deletions lib/omniauth-linkedin.rb
@@ -0,0 +1,9 @@
require "omniauth-linkedin/version"
require 'omniauth/strategies/linkedin'


module Omniauth

This comment has been minimized.

Copy link
@terrafied

terrafied Jun 11, 2014

@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… ❓

This comment has been minimized.

Copy link
@skorks

skorks Jun 12, 2014

Author Owner

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.

This comment has been minimized.

Copy link
@terrafied

terrafied Jun 12, 2014

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.

module Linkedin
# Your code goes here...
end
end
5 changes: 5 additions & 0 deletions lib/omniauth-linkedin/version.rb
@@ -0,0 +1,5 @@
module Omniauth
module Linkedin
VERSION = "0.0.1"
end
end
43 changes: 43 additions & 0 deletions 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 changes: 23 additions & 0 deletions 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.