omniauth-edmodo 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/omniauth/strategies/edmodo.rb +1 -1
- data/lib/omniauth-edmodo/version.rb +1 -1
- data/spec/omniauth/strategies/edmodo_spec.rb +65 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3b043fa2a5a2713712ef61ca74612a6d7ff5713
|
4
|
+
data.tar.gz: 71ff7005637d164f711958b763f5d43ad5c379a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa1c529367b5ccb66a5ab6ccc340b5951b135cad7aa46129290044c074c6656d9623ccab02ffce86e64e2fc0599769ff5dd70d2bb4097971ccda532d44e315df
|
7
|
+
data.tar.gz: de7e273ae1316787faf4d823534bda2194937ba789c886c79bd1d75ad5bd93e90909f4eea8df6d50d839bac8e5ff3c7b8c6631e58c59a972108aac802f1fe0ed
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Omniauth Edmodo
|
2
2
|
|
3
|
-
This is the OmniAuth strategy for authenticating to Edmodo.
|
3
|
+
This is the OmniAuth strategy for authenticating to Edmodo. To use it, you'll need to obtain an OAuth2 application key and secret from Edmodo.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,10 +18,14 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Basic Usage
|
20
20
|
|
21
|
-
|
21
|
+
There is no difference between the following code and using each strategy indivually as middleware. This is an example that you might put into a Rails initializer at config/initializers/omniauth.rb
|
22
|
+
|
23
|
+
Rails.application.config.use OmniAuth::Builder do
|
22
24
|
provider :edmodo, ENV['EDMODO_KEY'], ENV['EDMODO_SECRET'], scope: "basic,read_user_email"
|
23
25
|
end
|
24
26
|
|
27
|
+
See more at https://github.com/intridea/omniauth
|
28
|
+
|
25
29
|
## Contributing
|
26
30
|
|
27
31
|
1. Fork it ( https://github.com/[my-github-username]/omniauth-edmodo/fork )
|
@@ -60,4 +60,69 @@ describe OmniAuth::Strategies::Edmodo do
|
|
60
60
|
expect(subject.raw_info).to eq(parsed_response)
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
context '#info' do
|
65
|
+
before do
|
66
|
+
allow(access_token).to receive(:get).with('users/me').and_return(response)
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'when user signing in is a student' do
|
70
|
+
let(:parsed_response) do
|
71
|
+
{ 'url' => 'https://api.edmodo.com/users/123', 'id' => 123, 'type' => 'student' }
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should return empty profile' do
|
75
|
+
expect(subject.info).to eq({
|
76
|
+
'nickname' => nil,
|
77
|
+
'email' => nil,
|
78
|
+
'first_name' => nil,
|
79
|
+
'last_name' => nil,
|
80
|
+
'image' => nil
|
81
|
+
})
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'when user signing in is a teacher' do
|
86
|
+
let(:parsed_response) do
|
87
|
+
{
|
88
|
+
'url' => 'https://api.edmodo.com/users/123',
|
89
|
+
'id' => 123,
|
90
|
+
'type' => 'teacher',
|
91
|
+
'username' => 'jeff',
|
92
|
+
'email' => 'jeff@example.org',
|
93
|
+
'first_name' => 'Jeff',
|
94
|
+
'last_name' => 'Jefferson',
|
95
|
+
'avatars' => { 'large' => 'https://u.ph.edim.co/123/123.png' }
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'should return profile with nickname, email, first_name, last_name and image' do
|
100
|
+
expect(subject.info).to eq({
|
101
|
+
'nickname' => 'jeff',
|
102
|
+
'email' => 'jeff@example.org',
|
103
|
+
'first_name' => 'Jeff',
|
104
|
+
'last_name' => 'Jefferson',
|
105
|
+
'image' => 'https://u.ph.edim.co/123/123.png'
|
106
|
+
})
|
107
|
+
end
|
108
|
+
|
109
|
+
context 'without an avatar' do
|
110
|
+
let(:parsed_response) do
|
111
|
+
{
|
112
|
+
'url' => 'https://api.edmodo.com/users/123',
|
113
|
+
'id' => 123,
|
114
|
+
'type' => 'teacher',
|
115
|
+
'username' => 'jeff',
|
116
|
+
'email' => 'jeff@example.org',
|
117
|
+
'first_name' => 'Jeff',
|
118
|
+
'last_name' => 'Jefferson'
|
119
|
+
}
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'should include empty "image" property' do
|
123
|
+
expect(subject.info).to include({ 'image' => nil })
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
63
128
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-edmodo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerry Luk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.4.6
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: OmniAuth strategy for Edmodo
|