omniauth-yammer 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d60b5fa8d726cc6dec1c6309897e18340a4a6480
4
+ data.tar.gz: 3ad86493bc4ccc32d6a82f42caa70dd3cc5898b7
5
+ SHA512:
6
+ metadata.gz: a241e7b30559aef7ed9395b969c661119c05339947d971926d3527357a385ceb9773f3fe33cb4b29392b794870d3187f1040fe5257c4d59e5fbcbad3bf359387
7
+ data.tar.gz: 395bc7153caec539ad5eba2a6fb02d74aaf6d7a3d70b70e9a92f285791c9781cad92eca0c5463deb4380857c458faf26b32143a3d3865b3acf40044c3bff9842
data/.gitignore CHANGED
@@ -4,6 +4,7 @@
4
4
  .config
5
5
  .yardoc
6
6
  .project
7
+ .ruby-version
7
8
  Gemfile.lock
8
9
  InstalledFiles
9
10
  _yardoc
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - ruby-head
6
+ notifications:
7
+ email: false
8
+ branches:
9
+ only:
10
+ - master
11
+ - development
12
+ matrix:
13
+ allow_failures:
14
+ - rvm: ruby-head
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # OmniAuth Yammer
1
+ # OmniAuth Yammer [![Build Status](https://travis-ci.org/le0pard/omniauth-yammer.png)](https://travis-ci.org/le0pard/omniauth-yammer)
2
2
 
3
3
  This gem contains the Yammer strategy for OmniAuth 1.0.
4
4
 
5
- Supports the OAuth 2.0 server-side flow. Read the Yammer docs for more details: https://developer.yammer.com/api/oauth2.html
5
+ Supports the OAuth 2.0 server-side flow. Read the Yammer docs for more details: https://developer.yammer.com/authentication/#a-oauth2
6
6
 
7
7
  ## Installing
8
8
 
@@ -62,4 +62,12 @@ and edit devise config:
62
62
 
63
63
  ```ruby
64
64
  config.omniauth :yammer, "Consumer key", "Consumer secret", {:client_options => {:ssl => {:ca_file => "#{Rails.root}/lib/ca-bundle.crt" }}}
65
- ```
65
+ ```
66
+
67
+ ## Contributing
68
+
69
+ 1. Fork it
70
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
71
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
72
+ 4. Push to the branch (`git push origin my-new-feature`)
73
+ 5. Create new Pull Request
@@ -52,6 +52,10 @@ module OmniAuth
52
52
  @raw_info ||= access_token.get('/api/v1/users/current.json').parsed
53
53
  end
54
54
 
55
+ def primary_email
56
+ raw_info['contact']['email_addresses'].detect{|address| address['type'] == 'primary'}['address'] rescue nil
57
+ end
58
+
55
59
  private
56
60
 
57
61
  def prune!(hash)
@@ -61,9 +65,8 @@ module OmniAuth
61
65
  end
62
66
  end
63
67
 
64
- def primary_email
65
- raw_info['contact']['email_addresses'].detect{|address| address['type'] == 'primary'}['address']
66
- end
67
68
  end
68
69
  end
69
70
  end
71
+
72
+ OmniAuth.config.add_camelization 'yammer', 'Yammer'
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Yammer
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -20,6 +20,7 @@ Gem::Specification.new do |gem|
20
20
  gem.add_runtime_dependency 'omniauth-oauth2', '>= 1.1'
21
21
 
22
22
  gem.add_development_dependency 'rspec', '>= 2.7'
23
+ gem.add_development_dependency 'rake'
23
24
  gem.add_development_dependency 'rack-test'
24
25
  gem.add_development_dependency 'simplecov'
25
26
  gem.add_development_dependency 'webmock'
@@ -1,7 +1,86 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe OmniAuth::Strategies::Yammer do
4
- it 'should do some testing' do
5
- pending
4
+ subject { OmniAuth::Strategies::Yammer.new(nil) }
5
+
6
+ it 'should add a camelization for itself' do
7
+ OmniAuth::Utils.camelize('yammer').should == 'Yammer'
8
+ end
9
+
10
+ describe '#client' do
11
+ it 'has correct GaggleAMP site' do
12
+ subject.client.site.should eq('https://www.yammer.com')
13
+ end
14
+
15
+ it 'has correct authorize url' do
16
+ subject.client.options[:authorize_url].should eq('/dialog/oauth')
17
+ end
18
+
19
+ it 'has correct token url' do
20
+ subject.client.options[:token_url].should eq('/oauth2/access_token.json')
21
+ end
22
+ end
23
+
24
+ describe '#callback_path' do
25
+ it 'has the correct callback path' do
26
+ subject.callback_path.should eq('/auth/yammer/callback')
27
+ end
28
+ end
29
+
30
+ describe '#uid' do
31
+ before :each do
32
+ subject.stub(:raw_info) { { 'id' => 'uid' } }
33
+ end
34
+
35
+ it 'returns the id from raw_info' do
36
+ subject.uid.should eq('uid')
37
+ end
38
+ end
39
+
40
+ describe '#info' do
41
+ context 'and therefore has all the necessary fields' do
42
+ before :each do
43
+ subject.stub(:raw_info) { {
44
+ 'full_name' => 'John Doe',
45
+ 'contact' => {
46
+ 'email_addresses' => [
47
+ { 'type' => 'primary', 'address' => 'john.doe@example.com' }
48
+ ]
49
+ },
50
+ 'name' => 'JohnDoe'
51
+ } }
52
+ end
53
+
54
+ it { subject.info.should have_key :name }
55
+ it { subject.info.should have_key :email }
56
+ it { subject.info.should have_key :nickname }
57
+ end
58
+
59
+ context 'and does not fail with empty response' do
60
+ before :each do
61
+ subject.stub(:raw_info) { {} }
62
+ end
63
+
64
+ it { expect { subject.info }.not_to raise_error }
65
+ end
66
+ end
67
+
68
+ describe '#extra' do
69
+ before :each do
70
+ subject.stub(:raw_info) { { 'foo' => 'bar' } }
71
+ end
72
+
73
+ it { subject.extra[:raw_info].should eq({ 'foo' => 'bar' }) }
74
+ end
75
+
76
+ describe '#raw_info' do
77
+ before :each do
78
+ response = double('response', :parsed => { 'foo' => 'bar' })
79
+ subject.stub(:access_token) { double('access token', :get => response) }
80
+ end
81
+
82
+ it 'returns parsed response from access token' do
83
+ subject.raw_info.should eq({ 'foo' => 'bar' })
84
+ end
6
85
  end
7
86
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-yammer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
5
- prerelease:
4
+ version: 0.0.7
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alexey Vasiliev
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-17 00:00:00.000000000 Z
11
+ date: 2013-07-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: omniauth-oauth2
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,15 +34,27 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '2.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
46
55
  - !ruby/object:Gem::Dependency
47
56
  name: rack-test
48
57
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
58
  requirements:
51
59
  - - '>='
52
60
  - !ruby/object:Gem::Version
@@ -54,7 +62,6 @@ dependencies:
54
62
  type: :development
55
63
  prerelease: false
56
64
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
65
  requirements:
59
66
  - - '>='
60
67
  - !ruby/object:Gem::Version
@@ -62,7 +69,6 @@ dependencies:
62
69
  - !ruby/object:Gem::Dependency
63
70
  name: simplecov
64
71
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
72
  requirements:
67
73
  - - '>='
68
74
  - !ruby/object:Gem::Version
@@ -70,7 +76,6 @@ dependencies:
70
76
  type: :development
71
77
  prerelease: false
72
78
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
79
  requirements:
75
80
  - - '>='
76
81
  - !ruby/object:Gem::Version
@@ -78,7 +83,6 @@ dependencies:
78
83
  - !ruby/object:Gem::Dependency
79
84
  name: webmock
80
85
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
86
  requirements:
83
87
  - - '>='
84
88
  - !ruby/object:Gem::Version
@@ -86,7 +90,6 @@ dependencies:
86
90
  type: :development
87
91
  prerelease: false
88
92
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
93
  requirements:
91
94
  - - '>='
92
95
  - !ruby/object:Gem::Version
@@ -99,7 +102,7 @@ extensions: []
99
102
  extra_rdoc_files: []
100
103
  files:
101
104
  - .gitignore
102
- - .rvmrc
105
+ - .travis.yml
103
106
  - Gemfile
104
107
  - README.md
105
108
  - Rakefile
@@ -111,28 +114,25 @@ files:
111
114
  - spec/spec_helper.rb
112
115
  homepage: https://github.com/le0pard/omniauth-yammer
113
116
  licenses: []
117
+ metadata: {}
114
118
  post_install_message:
115
119
  rdoc_options: []
116
120
  require_paths:
117
121
  - lib
118
122
  required_ruby_version: !ruby/object:Gem::Requirement
119
- none: false
120
123
  requirements:
121
124
  - - '>='
122
125
  - !ruby/object:Gem::Version
123
126
  version: '0'
124
127
  required_rubygems_version: !ruby/object:Gem::Requirement
125
- none: false
126
128
  requirements:
127
129
  - - '>='
128
130
  - !ruby/object:Gem::Version
129
131
  version: '0'
130
132
  requirements: []
131
133
  rubyforge_project: omniauth-yammer
132
- rubygems_version: 1.8.25
134
+ rubygems_version: 2.0.3
133
135
  signing_key:
134
- specification_version: 3
136
+ specification_version: 4
135
137
  summary: OmniAuth strategy for Yammer
136
- test_files:
137
- - spec/omniauth/strategies/yammer_spec.rb
138
- - spec/spec_helper.rb
138
+ test_files: []
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm ruby-2.0.0-p0@omniauth-yammer-gem --create