omniauth-ohloh 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +9 -0
- data/Rakefile +1 -0
- data/example/Gemfile +6 -0
- data/example/config.ru +24 -0
- data/lib/omniauth-ohloh.rb +2 -0
- data/lib/omniauth-ohloh/version.rb +5 -0
- data/lib/omniauth/strategies/ohloh.rb +37 -0
- data/omniauth-ohloh.gemspec +24 -0
- metadata +120 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/example/Gemfile
ADDED
data/example/config.ru
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'sinatra'
|
4
|
+
require 'omniauth-ohloh'
|
5
|
+
|
6
|
+
get '/' do
|
7
|
+
redirect '/auth/ohloh'
|
8
|
+
end
|
9
|
+
|
10
|
+
get '/auth/:provider/callback' do
|
11
|
+
content_type 'text/plain'
|
12
|
+
request.env['omniauth.auth'].to_hash.inspect rescue "No Data"
|
13
|
+
end
|
14
|
+
|
15
|
+
get '/auth/failure' do
|
16
|
+
content_type 'text/plain'
|
17
|
+
request.env['omniauth.auth'].to_hash.inspect rescue "No Data"
|
18
|
+
end
|
19
|
+
|
20
|
+
use Rack::Session::Cookie
|
21
|
+
|
22
|
+
use OmniAuth::Builder do
|
23
|
+
provider :ohloh, ENV['OHLOH_API_KEY'], ENV['OHLOH_CONSUMER_SECRET']
|
24
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'omniauth-oauth'
|
2
|
+
require 'rexml/document'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Ohloh < OmniAuth::Strategies::OAuth
|
7
|
+
|
8
|
+
option :name, "ohloh"
|
9
|
+
|
10
|
+
option :client_options, {
|
11
|
+
:site => "http://www.ohloh.net",
|
12
|
+
:token_url => "/oauth/access_token"
|
13
|
+
}
|
14
|
+
|
15
|
+
uid{raw_info['id']}
|
16
|
+
|
17
|
+
info do
|
18
|
+
{
|
19
|
+
:name => raw_info['name'],
|
20
|
+
:location => raw_info['location'],
|
21
|
+
:image => raw_info['avatar_url']
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
extra do
|
26
|
+
{
|
27
|
+
'raw_info' => raw_info
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def raw_info
|
32
|
+
@raw_info ||= Hash[REXML::Document.new(access_token.get('/accounts/me.xml').body).root.get_elements('/response/result/account').first.elements.collect{|n| [n.name,n.text]}]
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "omniauth-ohloh/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "omniauth-ohloh"
|
7
|
+
s.version = Omniauth::Ohloh::VERSION
|
8
|
+
s.authors = ["Rodrigo Ayala"]
|
9
|
+
s.email = ["rayalac@yahoo.com"]
|
10
|
+
s.homepage = "https://github.com/RodrigoAyala/omniauth-ohloh"
|
11
|
+
s.summary = %q{Ohloh strategy for OmniAuth}
|
12
|
+
s.description = %q{Ohloh strategy for OmniAuth}
|
13
|
+
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.add_runtime_dependency 'omniauth-oauth'
|
20
|
+
|
21
|
+
s.add_development_dependency 'rspec', '~> 2.7.0'
|
22
|
+
s.add_development_dependency 'rake'
|
23
|
+
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-ohloh
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Rodrigo Ayala
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-11-29 00:00:00 -03:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: omniauth-oauth
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 19
|
44
|
+
segments:
|
45
|
+
- 2
|
46
|
+
- 7
|
47
|
+
- 0
|
48
|
+
version: 2.7.0
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: rake
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
type: :development
|
64
|
+
version_requirements: *id003
|
65
|
+
description: Ohloh strategy for OmniAuth
|
66
|
+
email:
|
67
|
+
- rayalac@yahoo.com
|
68
|
+
executables: []
|
69
|
+
|
70
|
+
extensions: []
|
71
|
+
|
72
|
+
extra_rdoc_files: []
|
73
|
+
|
74
|
+
files:
|
75
|
+
- .gitignore
|
76
|
+
- Gemfile
|
77
|
+
- README.md
|
78
|
+
- Rakefile
|
79
|
+
- example/Gemfile
|
80
|
+
- example/config.ru
|
81
|
+
- lib/omniauth-ohloh.rb
|
82
|
+
- lib/omniauth-ohloh/version.rb
|
83
|
+
- lib/omniauth/strategies/ohloh.rb
|
84
|
+
- omniauth-ohloh.gemspec
|
85
|
+
has_rdoc: true
|
86
|
+
homepage: https://github.com/RodrigoAyala/omniauth-ohloh
|
87
|
+
licenses: []
|
88
|
+
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
hash: 3
|
109
|
+
segments:
|
110
|
+
- 0
|
111
|
+
version: "0"
|
112
|
+
requirements: []
|
113
|
+
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 1.6.2
|
116
|
+
signing_key:
|
117
|
+
specification_version: 3
|
118
|
+
summary: Ohloh strategy for OmniAuth
|
119
|
+
test_files: []
|
120
|
+
|