omniauth-avvo 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/omniauth/avvo/version.rb +5 -0
- data/lib/omniauth/avvo.rb +2 -0
- data/lib/omniauth/strategies/avvo.rb +47 -0
- data/lib/omniauth-avvo.rb +1 -0
- data/omniauth-avvo.gemspec +18 -0
- metadata +65 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'omniauth/strategies/oauth2'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Avvo < OmniAuth::Strategies::OAuth2
|
7
|
+
option :name, "avvo"
|
8
|
+
option :client_options, {
|
9
|
+
:site => "http://api.avvo.com",
|
10
|
+
:authorize_url => '/api/2/oauth2/authorize',
|
11
|
+
:token_url => '/api/2/oauth2/authorize',
|
12
|
+
:ssl => {
|
13
|
+
:verify => false
|
14
|
+
}
|
15
|
+
}
|
16
|
+
option :authorize_options, [:scope, :state]
|
17
|
+
|
18
|
+
uid do
|
19
|
+
raw_info['id']
|
20
|
+
end
|
21
|
+
|
22
|
+
info do
|
23
|
+
{
|
24
|
+
:name => raw_info['friendly_name'],
|
25
|
+
:email => raw_info['email_address'],
|
26
|
+
:permissions => raw_info['permissions'],
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
extra do
|
31
|
+
{
|
32
|
+
:raw_info => raw_info
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def raw_info
|
37
|
+
@raw_info ||= begin
|
38
|
+
access_token.options[:header_format] = "OAuth %s"
|
39
|
+
json = access_token.get('/api/2/users/me').body
|
40
|
+
user_data = JSON.parse(json) || {} rescue {}
|
41
|
+
user_data["user"] || {}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/avvo'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Provide a simple gemspec so you can easily use your enginex
|
2
|
+
# project in your rails apps through git.
|
3
|
+
require File.expand_path('../lib/omniauth/avvo/version', __FILE__)
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "omniauth-avvo"
|
6
|
+
s.version = OmniAuth::Avvo::VERSION
|
7
|
+
s.description = 'Avvo.com strategy for OmniAuth'
|
8
|
+
s.summary = 'Avvo.com strategy for OmniAuth'
|
9
|
+
s.add_dependency "omniauth-oauth2", "~> 1.1.0"
|
10
|
+
|
11
|
+
s.author = "Jeff Ching"
|
12
|
+
s.email = "ching.jeff@gmail.com"
|
13
|
+
s.homepage = "http://github.com/chingor13/omniauth-avvo"
|
14
|
+
s.has_rdoc = true
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = Dir.glob('test/*_test.rb')
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-avvo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jeff Ching
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth-oauth2
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.1.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.1.0
|
30
|
+
description: Avvo.com strategy for OmniAuth
|
31
|
+
email: ching.jeff@gmail.com
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- lib/omniauth-avvo.rb
|
37
|
+
- lib/omniauth/avvo.rb
|
38
|
+
- lib/omniauth/avvo/version.rb
|
39
|
+
- lib/omniauth/strategies/avvo.rb
|
40
|
+
- omniauth-avvo.gemspec
|
41
|
+
homepage: http://github.com/chingor13/omniauth-avvo
|
42
|
+
licenses: []
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 1.8.24
|
62
|
+
signing_key:
|
63
|
+
specification_version: 3
|
64
|
+
summary: Avvo.com strategy for OmniAuth
|
65
|
+
test_files: []
|