oa-recruitmilitary 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,49 +1,52 @@
|
|
1
|
-
require 'omniauth
|
2
|
-
require 'multi_json'
|
1
|
+
require 'omniauth-oauth2'
|
3
2
|
|
4
3
|
module OmniAuth
|
5
4
|
module Strategies
|
6
|
-
class Recruitmilitary < OAuth2
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
class Recruitmilitary < ::OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, "recruitmilitary"
|
7
|
+
|
8
|
+
option :client_options, {
|
9
|
+
:site => ::OmniAuth::RecruitMilitary.configuration.site,
|
10
|
+
:authorize_url => ::OmniAuth::RecruitMilitary.configuration.authorize_url,
|
11
|
+
:token_url => ::OmniAuth::RecruitMilitary.configuration.access_token_url,
|
12
|
+
}
|
13
|
+
|
14
|
+
uid{ user_hash['id'] }
|
15
|
+
|
16
|
+
info do
|
17
|
+
{
|
18
|
+
:name => user_name,
|
19
|
+
:email => user_hash['email'],
|
20
|
+
}
|
15
21
|
end
|
16
22
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
23
|
+
extra do
|
24
|
+
{
|
25
|
+
'email' => user_hash['email'],
|
26
|
+
'roles' => user_hash['roles'],
|
27
|
+
'first_name' => user_hash['first_name'],
|
28
|
+
'last_name' => user_hash['last_name'],
|
29
|
+
'military_branch_id' => user_hash['military_branch_id'],
|
30
|
+
'military_status_id' => user_hash['military_status_id'],
|
31
|
+
'gender_id' => user_hash['gender_id'],
|
32
|
+
}
|
21
33
|
end
|
22
34
|
|
23
|
-
def
|
24
|
-
|
25
|
-
super
|
35
|
+
def raw_info
|
36
|
+
@raw_info ||= @access_token.get(RecruitMilitary.configuration.user_data_url).parsed
|
26
37
|
end
|
27
38
|
|
28
39
|
def user_hash
|
29
|
-
|
40
|
+
raw_info['user']
|
30
41
|
end
|
31
42
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
'email' => user_hash['email'],
|
38
|
-
'roles' => user_hash['roles'],
|
39
|
-
'first_name' => user_hash['first_name'],
|
40
|
-
'last_name' => user_hash['last_name'],
|
41
|
-
'military_branch_id' => user_hash['military_branch_id'],
|
42
|
-
'military_status_id' => user_hash['military_status_id'],
|
43
|
-
'gender_id' => user_hash['gender_id'],
|
44
|
-
}
|
45
|
-
})
|
43
|
+
def user_name
|
44
|
+
[
|
45
|
+
user_hash['first_name'],
|
46
|
+
user_hash['last_name'],
|
47
|
+
].join(' ')
|
46
48
|
end
|
49
|
+
|
47
50
|
end
|
48
51
|
end
|
49
52
|
end
|
data/oa-recruitmilitary.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.add_dependency 'omniauth', '~> 0.
|
22
|
+
s.add_dependency 'omniauth-oauth2', '~> 1.0.0'
|
23
23
|
|
24
24
|
s.add_development_dependency 'rspec', '~> 2.6'
|
25
25
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oa-recruitmilitary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Guterl
|
@@ -15,22 +15,22 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-27 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name: omniauth
|
21
|
+
name: omniauth-oauth2
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
26
|
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
28
|
+
hash: 23
|
29
29
|
segments:
|
30
|
+
- 1
|
30
31
|
- 0
|
31
|
-
-
|
32
|
-
|
33
|
-
version: 0.2.6
|
32
|
+
- 0
|
33
|
+
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
version_requirements: *id001
|
36
36
|
- !ruby/object:Gem::Dependency
|