omniauth-yammer 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/README.md +9 -3
- data/lib/omniauth/strategies/yammer.rb +11 -11
- data/lib/omniauth-yammer/version.rb +1 -1
- data/omniauth-yammer.gemspec +4 -5
- metadata +49 -22
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm ruby-
|
1
|
+
rvm ruby-2.0.0-p0@omniauth-yammer-gem --create
|
data/README.md
CHANGED
@@ -34,6 +34,12 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
34
34
|
end
|
35
35
|
```
|
36
36
|
|
37
|
+
For changing default domain in gem (for dev or testing purpose) use YAMMER\_DOMAIN environment variable:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
ENV['YAMMER_DOMAIN'] = 'https://staging.yammer.com'
|
41
|
+
```
|
42
|
+
|
37
43
|
### Devise
|
38
44
|
|
39
45
|
Add this line to devise config:
|
@@ -46,14 +52,14 @@ config.omniauth :yammer, "Consumer key", "Consumer secret"
|
|
46
52
|
If you have this error:
|
47
53
|
|
48
54
|
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
|
49
|
-
|
55
|
+
|
50
56
|
Then you can fix this by setting valid cert:
|
51
57
|
|
52
58
|
wget http://www.cacert.org/certs/root.crt
|
53
59
|
cat root.crt >> lib/ca-bundle.crt
|
54
|
-
|
60
|
+
|
55
61
|
and edit devise config:
|
56
62
|
|
57
63
|
```ruby
|
58
|
-
config.omniauth :yammer, "Consumer key", "Consumer secret", {:client_options => {:ssl => {:ca_file => "#{Rails.root}/lib/ca-bundle.crt" }}}
|
64
|
+
config.omniauth :yammer, "Consumer key", "Consumer secret", {:client_options => {:ssl => {:ca_file => "#{Rails.root}/lib/ca-bundle.crt" }}}
|
59
65
|
```
|
@@ -3,17 +3,17 @@ require 'omniauth-oauth2'
|
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
5
5
|
class Yammer < OmniAuth::Strategies::OAuth2
|
6
|
-
|
6
|
+
|
7
7
|
option :name, 'yammer'
|
8
|
-
|
8
|
+
|
9
9
|
option :client_options, {
|
10
|
-
:site => 'https://www.yammer.com',
|
10
|
+
:site => (ENV['YAMMER_DOMAIN'] || 'https://www.yammer.com'),
|
11
11
|
:authorize_url => '/dialog/oauth',
|
12
12
|
:token_url => '/oauth2/access_token.json'
|
13
13
|
}
|
14
|
-
|
14
|
+
|
15
15
|
uid { raw_info['id'] }
|
16
|
-
|
16
|
+
|
17
17
|
info do
|
18
18
|
prune!({
|
19
19
|
:nickname => raw_info['name'],
|
@@ -31,27 +31,27 @@ module OmniAuth
|
|
31
31
|
extra do
|
32
32
|
prune!({:raw_info => raw_info})
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def request_phase
|
36
36
|
options[:response_type] ||= 'code'
|
37
37
|
super
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def callback_phase
|
41
41
|
request.params['state'] = session['omniauth.state']
|
42
42
|
super
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
def build_access_token
|
46
46
|
access_token = super
|
47
47
|
token = eval(access_token.token)['token']
|
48
48
|
@access_token = ::OAuth2::AccessToken.new(client, token, access_token.params)
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
def raw_info
|
52
52
|
@raw_info ||= access_token.get('/api/v1/users/current.json').parsed
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
private
|
56
56
|
|
57
57
|
def prune!(hash)
|
@@ -60,7 +60,7 @@ module OmniAuth
|
|
60
60
|
value.nil? || (value.respond_to?(:empty?) && value.empty?)
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
def primary_email
|
65
65
|
raw_info['contact']['email_addresses'].detect{|address| address['type'] == 'primary'}['address']
|
66
66
|
end
|
data/omniauth-yammer.gemspec
CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["leopard.not.a@gmail.com"]
|
7
7
|
gem.description = %q{OmniAuth strategy for Yammer}
|
8
8
|
gem.summary = %q{OmniAuth strategy for Yammer}
|
9
|
-
gem.homepage = ""
|
10
|
-
|
9
|
+
gem.homepage = "https://github.com/le0pard/omniauth-yammer"
|
10
|
+
|
11
11
|
gem.rubyforge_project = "omniauth-yammer"
|
12
12
|
|
13
13
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
@@ -16,10 +16,9 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.name = "omniauth-yammer"
|
17
17
|
gem.require_paths = ["lib"]
|
18
18
|
gem.version = OmniAuth::Yammer::VERSION
|
19
|
-
|
20
|
-
|
19
|
+
|
21
20
|
gem.add_runtime_dependency 'omniauth-oauth2', '>= 1.1'
|
22
|
-
|
21
|
+
|
23
22
|
gem.add_development_dependency 'rspec', '>= 2.7'
|
24
23
|
gem.add_development_dependency 'rack-test'
|
25
24
|
gem.add_development_dependency 'simplecov'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-yammer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,63 +9,88 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-oauth2
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '1.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.1'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rspec
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
|
-
- -
|
35
|
+
- - '>='
|
31
36
|
- !ruby/object:Gem::Version
|
32
37
|
version: '2.7'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.7'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rack-test
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
|
-
- -
|
51
|
+
- - '>='
|
42
52
|
- !ruby/object:Gem::Version
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: simplecov
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
|
-
- -
|
67
|
+
- - '>='
|
53
68
|
- !ruby/object:Gem::Version
|
54
69
|
version: '0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: webmock
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
|
-
- -
|
83
|
+
- - '>='
|
64
84
|
- !ruby/object:Gem::Version
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
description: OmniAuth strategy for Yammer
|
70
95
|
email:
|
71
96
|
- leopard.not.a@gmail.com
|
@@ -84,7 +109,7 @@ files:
|
|
84
109
|
- omniauth-yammer.gemspec
|
85
110
|
- spec/omniauth/strategies/yammer_spec.rb
|
86
111
|
- spec/spec_helper.rb
|
87
|
-
homepage:
|
112
|
+
homepage: https://github.com/le0pard/omniauth-yammer
|
88
113
|
licenses: []
|
89
114
|
post_install_message:
|
90
115
|
rdoc_options: []
|
@@ -93,19 +118,21 @@ require_paths:
|
|
93
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
119
|
none: false
|
95
120
|
requirements:
|
96
|
-
- -
|
121
|
+
- - '>='
|
97
122
|
- !ruby/object:Gem::Version
|
98
123
|
version: '0'
|
99
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
125
|
none: false
|
101
126
|
requirements:
|
102
|
-
- -
|
127
|
+
- - '>='
|
103
128
|
- !ruby/object:Gem::Version
|
104
129
|
version: '0'
|
105
130
|
requirements: []
|
106
131
|
rubyforge_project: omniauth-yammer
|
107
|
-
rubygems_version: 1.8.
|
132
|
+
rubygems_version: 1.8.25
|
108
133
|
signing_key:
|
109
134
|
specification_version: 3
|
110
135
|
summary: OmniAuth strategy for Yammer
|
111
|
-
test_files:
|
136
|
+
test_files:
|
137
|
+
- spec/omniauth/strategies/yammer_spec.rb
|
138
|
+
- spec/spec_helper.rb
|