omniauth-devpost 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6cffa0603342e24acd9961652e4f0cc6df3501ca
4
- data.tar.gz: 200fb44dfec674893f7aab5ea5689e6fa2da69df
3
+ metadata.gz: c0698afbfcd20fd700814e9f0748f93e6709801c
4
+ data.tar.gz: 22c73086639b2b2c73cb4cdc26b8df6b0587000f
5
5
  SHA512:
6
- metadata.gz: 10ab9bfc9abe8cacf474fee5fe9a854584d8964652cdcd99be37436a4db13a78e57792200efe1110984dc726658a70a284799e88f946d7b4c41e469fd1f02a1a
7
- data.tar.gz: 6a570c02de3198abbee74d5e33587cfd84444f2e0ff0b6b3a48fe287707f72ee635cd811062e41322156bb0eac1e5a5326d84624ad60df7b9954d2d038af24a1
6
+ metadata.gz: 27b6d27764caf3c44f4796951ff0296b4d2d612a326eaa76e527df118534d8819e6913133f85f8205b643e5caf641ac90b0bb2d8904910cf5494e98c576e2b46
7
+ data.tar.gz: 3e6d666e5daea1f66d3305ef83d90e25f32f56c27f442626bd0e1a6ff8fa7d3231c87024b48db68cbb469389e051d23b668a0176671de334d199e79d23aaf36a
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
4
+ cache: bundler
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Ross Kaffenberger
1
+ Copyright (c) 2012-2016 Ross Kaffenberger and contributors
2
2
 
3
3
  MIT License
4
4
 
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Omniauth::Devpost
2
2
 
3
+ [![Build Status](https://travis-ci.org/challengepost/omniauth-devpost.svg?branch=master)](https://travis-ci.org/challengepost/omniauth-devpost) [![Gem Version](https://badge.fury.io/rb/omniauth-devpost.svg)](https://badge.fury.io/rb/omniauth-devpost)
4
+
3
5
  Use this gem to authenticate against the (future) Devpost user api.
4
6
 
5
7
  ## Installation
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Devpost
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -25,11 +25,21 @@ module OmniAuth
25
25
 
26
26
  info do
27
27
  prune!({
28
+ 'name' => [raw_info['first_name'], raw_info['last_name']].join(" ").strip,
28
29
  'nickname' => raw_info['screen_name'],
29
30
  'email' => raw_info['email'],
30
- 'location' => raw_info['location'],
31
+ 'location' => (raw_info['location'] || {})['address'],
31
32
  'first_name' => raw_info['first_name'],
32
- 'last_name' => raw_info['last_name']
33
+ 'last_name' => raw_info['last_name'],
34
+ 'description' => raw_info['tagline'],
35
+ 'image' => raw_info['avatar_url'],
36
+ 'urls' => {
37
+ "Devpost" => raw_info['url'],
38
+ "Github" => raw_info['urls']['github'],
39
+ "Twitter" => raw_info['urls']['twitter'],
40
+ "LinkedIn" => raw_info['urls']['linkedin'],
41
+ "Website" => raw_info['urls']['website']
42
+ }
33
43
  })
34
44
  end
35
45
 
@@ -43,6 +43,7 @@ describe OmniAuth::Strategies::Devpost do
43
43
  url_base = 'http://auth.request.com'
44
44
  allow(@request).to receive(:url) { "#{url_base}/some/page" }
45
45
  allow(subject).to receive(:script_name) { '' } # as not to depend on Rack env
46
+ allow(@request).to receive(:query_string) { "" }
46
47
  expect(subject.callback_url).to eq("#{url_base}/auth/devpost/callback")
47
48
  end
48
49
 
@@ -50,6 +51,7 @@ describe OmniAuth::Strategies::Devpost do
50
51
  url_base = 'http://auth.request.com'
51
52
  @options = { :callback_path => "/auth/CP/done"}
52
53
  allow(@request).to receive(:url) { "#{url_base}/some/page" }
54
+ allow(@request).to receive(:query_string) { "" }
53
55
  allow(subject).to receive(:script_name) { '' } # as not to depend on Rack env
54
56
  expect(subject.callback_url).to eq("#{url_base}/auth/CP/done")
55
57
  end
@@ -70,7 +72,7 @@ describe OmniAuth::Strategies::Devpost do
70
72
  context 'when optional data is not present in raw info' do
71
73
  before :each do
72
74
 
73
- allow(subject).to receive(:raw_info) { {} }
75
+ allow(subject).to receive(:raw_info) { { "urls" => {} } }
74
76
  end
75
77
 
76
78
  it 'has no email key' do
@@ -97,7 +99,7 @@ describe OmniAuth::Strategies::Devpost do
97
99
 
98
100
  context 'when optional data is present in raw info' do
99
101
  before :each do
100
- @raw_info ||= { 'screen_name' => 'fredsmith' }
102
+ @raw_info ||= { 'screen_name' => 'fredsmith', 'urls' => {} }
101
103
  allow(subject).to receive(:raw_info) { @raw_info }
102
104
  end
103
105
 
@@ -126,10 +128,46 @@ describe OmniAuth::Strategies::Devpost do
126
128
  end
127
129
 
128
130
  it 'returns the location name as location' do
129
- @raw_info['location'] = 'Palo Alto, California'
131
+ @raw_info['location'] = { 'address' => 'Palo Alto, California' }
130
132
  expect(subject.info['location']).to eq('Palo Alto, California')
131
133
  end
132
134
 
135
+ it 'returns social urls as urls' do
136
+ @raw_info['urls'] = {
137
+ "github" => "https://github.com/challengepost"
138
+ }
139
+ expect(subject.info['urls']['Github']).to eq("https://github.com/challengepost")
140
+ end
141
+
142
+ it 'returns expected urls when filled' do
143
+ @raw_info['url'] = 'https://devpost.com/whatever'
144
+ @raw_info['urls'] = [
145
+ "github",
146
+ "twitter",
147
+ "linkedin",
148
+ "website"
149
+ ].map { |service| [service, "https://#{service}.com/whatever"] }.to_h
150
+
151
+ expected_keys = [
152
+ "Devpost",
153
+ "Github",
154
+ "Twitter",
155
+ "LinkedIn",
156
+ "Website"
157
+ ]
158
+
159
+ expect(subject.info['urls'].keys).to match(expected_keys)
160
+ end
161
+
162
+ it 'key not present when url not filled' do
163
+ @raw_info['url'] = "https://devpost.com/whatever"
164
+ @raw_info['urls']['github'] = ""
165
+
166
+ not_expected_key = ["Github"]
167
+
168
+ expect(subject.info['urls'].keys).not_to include(not_expected_key)
169
+ end
170
+
133
171
  end
134
172
 
135
173
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-devpost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Kaffenberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-24 00:00:00.000000000 Z
11
+ date: 2016-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
63
  - ".rspec"
64
+ - ".travis.yml"
64
65
  - Gemfile
65
66
  - LICENSE
66
67
  - README.md
@@ -90,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
91
  version: '0'
91
92
  requirements: []
92
93
  rubyforge_project:
93
- rubygems_version: 2.2.3
94
+ rubygems_version: 2.4.5.1
94
95
  signing_key:
95
96
  specification_version: 4
96
97
  summary: Official OmniAuth strategy for Devpost.