omniauth-exvo 0.0.3 → 0.0.4

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: c1d8776a35e652bdd896e366dcc40a04f7f02e13
4
+ data.tar.gz: 7061febb015d2f346842dbf9c7ee90fb57e29c35
5
+ SHA512:
6
+ metadata.gz: 42c2ab76a60392842d26d80e78ddedbf17c712cac049c96ec2a398b5d090c3e0efb9781c17357d7cb90872a66da172905bf858b7d09f37a806112d79b6b62774
7
+ data.tar.gz: 154e194f9b3eaf790ceee84cf4a907eb4d542a8cc180b3934f3581978f0d0a23dd14720b6ca608014b3ed50af6c96f3413636212f5309bd45aff021ae733a315
data/.gitignore CHANGED
@@ -3,3 +3,4 @@
3
3
  Gemfile.lock
4
4
  coverage/*
5
5
  pkg/*
6
+ tmp/*
@@ -1,4 +1,4 @@
1
- Copyright © 2011-2012 Exvo.com Development BV
1
+ Copyright © 2011-2013 Exvo.com Development BV
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -16,25 +16,67 @@ gem 'omniauth-exvo'
16
16
  Then `bundle install`.
17
17
 
18
18
 
19
- ## Basic usage
19
+ ## Usage
20
20
 
21
- Set both `ENV['AUTH_CLIENT_ID']` and `ENV['AUTH_CLIENT_SECRET']` somewhere (vhost configuration, heroku config, `config/environments/*` or even `config/application.rb`).
21
+ `OmniAuth::Strategies::Exvo` is simply a Rack middleware. Read the OmniAuth 1.0 docs for detailed instructions: https://github.com/intridea/omniauth.
22
+
23
+ Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth_exvo.rb`:
22
24
 
23
25
  ```ruby
24
- use OmniAuth::Builder do
26
+ Rails.application.config.middleware.use OmniAuth::Builder do
25
27
  provider :exvo, ENV['AUTH_CLIENT_ID'], ENV['AUTH_CLIENT_SECRET']
26
28
  end
27
29
  ```
28
30
 
29
- If you'd like to use Exvo's staging auth, you need to pass the `:client_options` hash to override the default:
31
+ You need to set both `ENV['AUTH_CLIENT_ID']` and `ENV['AUTH_CLIENT_SECRET']` somewhere (vhost configuration, heroku config, `config/environments/*` or even `config/application.rb`).
32
+
33
+
34
+ If you'd like to use Exvo-Auth app in staging or development environments, you need to pass the `:client_options` hash to override the default:
30
35
 
31
36
  ```ruby
32
- use OmniAuth::Builder do
33
- provider :exvo, ENV['AUTH_CLIENT_ID'], ENV['AUTH_CLIENT_SECRET'], :client_options => { :site => 'http://staging.auth.exvo.com' }
37
+ Rails.application.config.middleware.use OmniAuth::Builder do
38
+ provider :exvo, ENV['AUTH_CLIENT_ID'], ENV['AUTH_CLIENT_SECRET'], :client_options => { :site => Exvo::Helpers.auth_uri }
34
39
  end
35
40
  ```
36
41
 
42
+ Also read about the [exvo_helpers](https://github.com/Exvo/exvo_helpers) gem.
43
+
37
44
 
45
+ ## Auth Hash
46
+
47
+ Here's an example *Auth Hash* available in `request.env['omniauth.auth']` (data as of 2013-04):
48
+
49
+ ```ruby
50
+ request.env["omniauth.auth"].to_hash.inspect
51
+
52
+ {
53
+ "provider" => "exvo",
54
+ "uid" => 1,
55
+
56
+ "credentials" => {
57
+ "token" => "a2d09701559b9f26a8284d6f94670477d882ad6d9f3d92ce9917262a6b54085fa3fb99e111340459",
58
+ "expires" => false
59
+ },
60
+
61
+ "info" => {
62
+ "nickname" => "Pawel",
63
+ "email" => "pawel@exvo.com",
64
+ "name" => "Pawel"
65
+ },
66
+
67
+ "extra" => {
68
+ "raw_info" => {
69
+ "id" => 1,
70
+ "nickname" => "Pawel",
71
+ "country_code" => "PL",
72
+ "plan" => "basic",
73
+ "language" => "en",
74
+ "email" => "pawel@exvo.com",
75
+ "referring_user_id" => nil
76
+ }
77
+ }
78
+ }
79
+ ```
38
80
 
39
81
 
40
- Copyright © 2011-2012 Exvo.com Development BV, released under the MIT license
82
+ Copyright © 2011-2013 Exvo.com Development BV, released under the MIT license
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Exvo
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ module OmniAuth
12
12
  }
13
13
 
14
14
  def request_phase
15
- %w(scope state x_sign_up).each do |param|
15
+ %w(scope x_sign_up).each do |param|
16
16
  options[:authorize_params][param.to_sym] = request[param] if request[param]
17
17
  end
18
18
  super
@@ -9,7 +9,8 @@ Gem::Specification.new do |gem|
9
9
  gem.email = ["pawel.goscicki@gmail.com"]
10
10
  gem.homepage = "https://github.com/Exvo/omniauth-exvo/"
11
11
  gem.summary = "OmniAuth strategy for Exvo"
12
- gem.description = "OmniAuth strategy for Exvo"
12
+ gem.description = "OmniAuth strategy for the Exvo platform."
13
+ gem.license = "MIT"
13
14
 
14
15
  gem.files = `git ls-files`.split("\n")
15
16
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -23,11 +24,17 @@ Gem::Specification.new do |gem|
23
24
  gem.add_development_dependency 'rack-test'
24
25
  gem.add_development_dependency 'webmock'
25
26
 
27
+ gem.add_development_dependency "rake"
28
+
26
29
  gem.add_development_dependency 'guard', ['~> 1.0']
27
30
  gem.add_development_dependency 'guard-rspec', ['>= 0.6.0']
28
31
  gem.add_development_dependency "rb-fsevent"
29
32
  gem.add_development_dependency "rb-inotify"
30
33
 
34
+ gem.add_development_dependency 'pry'
35
+ gem.add_development_dependency 'pry-doc'
36
+ gem.add_development_dependency 'hirb'
37
+
31
38
  gem.add_development_dependency "simplecov"
32
39
  gem.add_development_dependency "simplecov-rcov"
33
40
  end
@@ -6,9 +6,9 @@ describe OmniAuth::Strategies::Exvo do
6
6
 
7
7
  def set_app!
8
8
  self.app = Rack::Builder.app do
9
- use Rack::Session::Cookie
9
+ use Rack::Session::Cookie, secret: 'some secret key'
10
10
  use OmniAuth::Strategies::Exvo
11
- run lambda { |env| [200, {'env' => env}, ['Hello!']] }
11
+ run lambda { |env| [200, { 'Content-Type' => 'text/plain', 'env' => env }, ['Hello!']] }
12
12
  end
13
13
  end
14
14
 
@@ -42,7 +42,11 @@ describe OmniAuth::Strategies::Exvo do
42
42
 
43
43
  describe '#callback_url' do
44
44
  before do
45
+ OmniAuth.config.test_mode = false
46
+ set_app!
47
+
45
48
  subject.request.should_receive(:url).and_return('https://auth.exvo.com')
49
+ subject.request.should_receive(:env).at_least(:once).and_return(double(:[] => '')) # stubs request.env['HTTP_X_FORWARDED_PROTO']
46
50
  subject.should_receive(:script_name).and_return('')
47
51
  end
48
52
 
@@ -106,29 +110,33 @@ describe OmniAuth::Strategies::Exvo do
106
110
  end
107
111
 
108
112
  specify { subject.credentials.should be_a(Hash) }
109
-
110
113
  specify { subject.credentials['token'].should eq('123') }
111
-
112
114
  specify { subject.credentials['expires'].should eq(false) }
113
115
  end
114
116
 
115
117
  describe '#request_phase' do
118
+ let(:uri) { URI.parse(last_response.location) }
119
+ let(:query_params) { Rack::Utils.parse_nested_query(uri.query) }
120
+
116
121
  before do
122
+ OmniAuth.config.test_mode = false
117
123
  set_app!
118
124
  end
119
125
 
120
- it 'redirects to auth app with a callback param' do
126
+ it 'redirects to the auth app' do
121
127
  get '/auth/exvo'
122
128
  last_response.should be_redirect
123
- follow_redirect!
124
- last_request.url.should match(/^https:\/\/auth\.exvo\.com\/.+callback$/)
129
+ last_response.location.should match(/^https:\/\/auth\.exvo\.com\/oauth\/authorize/)
125
130
  end
126
131
 
127
- it 'passes a custom x_sign_up authorize param' do
132
+ it 'includes a callback redirect param' do
133
+ get '/auth/exvo'
134
+ query_params['redirect_uri'].should match(/\/auth\/exvo\/callback$/)
135
+ end
136
+
137
+ it 'includes a custom x_sign_up authorize param' do
128
138
  get '/auth/exvo?x_sign_up=true'
129
- last_response.should be_redirect
130
- follow_redirect!
131
- last_request.url.should match(/^https:\/\/auth\.exvo\.com\/.+x_sign_up=true$/)
139
+ query_params['x_sign_up'].should eql("true")
132
140
  end
133
141
  end
134
142
 
data/spec/spec_helper.rb CHANGED
@@ -8,11 +8,18 @@ $:.unshift(File.dirname(__FILE__))
8
8
 
9
9
  require 'rack/test'
10
10
  require 'omniauth-exvo'
11
+ require 'pry'
11
12
 
12
13
  Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
13
14
 
14
15
  RSpec.configure do |config|
16
+
15
17
  config.mock_with :rspec
16
18
  config.include Rack::Test::Methods
17
19
  config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
20
+
21
+ config.before(:each) do
22
+ OmniAuth.config.test_mode = true
23
+ end
24
+
18
25
  end
metadata CHANGED
@@ -1,138 +1,226 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-exvo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Paweł Gościcki
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-03-16 00:00:00.000000000Z
11
+ date: 2013-04-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: omniauth
16
- requirement: &78718760 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *78718760
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: omniauth-oauth2
27
- requirement: &78718210 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ~>
31
32
  - !ruby/object:Gem::Version
32
33
  version: '1.0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *78718210
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: rspec
38
- requirement: &78717680 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - '>='
42
46
  - !ruby/object:Gem::Version
43
47
  version: '2.8'
44
48
  type: :development
45
49
  prerelease: false
46
- version_requirements: *78717680
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '2.8'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: rack-test
49
- requirement: &78716880 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  type: :development
56
63
  prerelease: false
57
- version_requirements: *78716880
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: webmock
60
- requirement: &78715470 !ruby/object:Gem::Requirement
61
- none: false
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
62
86
  requirements:
63
- - - ! '>='
87
+ - - '>='
64
88
  - !ruby/object:Gem::Version
65
89
  version: '0'
66
90
  type: :development
67
91
  prerelease: false
68
- version_requirements: *78715470
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: guard
71
- requirement: &78714090 !ruby/object:Gem::Requirement
72
- none: false
99
+ requirement: !ruby/object:Gem::Requirement
73
100
  requirements:
74
101
  - - ~>
75
102
  - !ruby/object:Gem::Version
76
103
  version: '1.0'
77
104
  type: :development
78
105
  prerelease: false
79
- version_requirements: *78714090
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '1.0'
80
111
  - !ruby/object:Gem::Dependency
81
112
  name: guard-rspec
82
- requirement: &78713640 !ruby/object:Gem::Requirement
83
- none: false
113
+ requirement: !ruby/object:Gem::Requirement
84
114
  requirements:
85
- - - ! '>='
115
+ - - '>='
86
116
  - !ruby/object:Gem::Version
87
117
  version: 0.6.0
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *78713640
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: 0.6.0
91
125
  - !ruby/object:Gem::Dependency
92
126
  name: rb-fsevent
93
- requirement: &78713360 !ruby/object:Gem::Requirement
94
- none: false
127
+ requirement: !ruby/object:Gem::Requirement
95
128
  requirements:
96
- - - ! '>='
129
+ - - '>='
97
130
  - !ruby/object:Gem::Version
98
131
  version: '0'
99
132
  type: :development
100
133
  prerelease: false
101
- version_requirements: *78713360
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
102
139
  - !ruby/object:Gem::Dependency
103
140
  name: rb-inotify
104
- requirement: &78712940 !ruby/object:Gem::Requirement
105
- none: false
141
+ requirement: !ruby/object:Gem::Requirement
106
142
  requirements:
107
- - - ! '>='
143
+ - - '>='
108
144
  - !ruby/object:Gem::Version
109
145
  version: '0'
110
146
  type: :development
111
147
  prerelease: false
112
- version_requirements: *78712940
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: pry-doc
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: hirb
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - '>='
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
113
195
  - !ruby/object:Gem::Dependency
114
196
  name: simplecov
115
- requirement: &78712390 !ruby/object:Gem::Requirement
116
- none: false
197
+ requirement: !ruby/object:Gem::Requirement
117
198
  requirements:
118
- - - ! '>='
199
+ - - '>='
119
200
  - !ruby/object:Gem::Version
120
201
  version: '0'
121
202
  type: :development
122
203
  prerelease: false
123
- version_requirements: *78712390
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - '>='
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
124
209
  - !ruby/object:Gem::Dependency
125
210
  name: simplecov-rcov
126
- requirement: &78711900 !ruby/object:Gem::Requirement
127
- none: false
211
+ requirement: !ruby/object:Gem::Requirement
128
212
  requirements:
129
- - - ! '>='
213
+ - - '>='
130
214
  - !ruby/object:Gem::Version
131
215
  version: '0'
132
216
  type: :development
133
217
  prerelease: false
134
- version_requirements: *78711900
135
- description: OmniAuth strategy for Exvo
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ description: OmniAuth strategy for the Exvo platform.
136
224
  email:
137
225
  - pawel.goscicki@gmail.com
138
226
  executables: []
@@ -141,7 +229,7 @@ extra_rdoc_files: []
141
229
  files:
142
230
  - .gitignore
143
231
  - Gemfile
144
- - MIT-LICENSE
232
+ - LICENSE
145
233
  - README.md
146
234
  - Rakefile
147
235
  - lib/omniauth-exvo.rb
@@ -152,28 +240,28 @@ files:
152
240
  - spec/spec_helper.rb
153
241
  - spec/support/shared_examples.rb
154
242
  homepage: https://github.com/Exvo/omniauth-exvo/
155
- licenses: []
243
+ licenses:
244
+ - MIT
245
+ metadata: {}
156
246
  post_install_message:
157
247
  rdoc_options: []
158
248
  require_paths:
159
249
  - lib
160
250
  required_ruby_version: !ruby/object:Gem::Requirement
161
- none: false
162
251
  requirements:
163
- - - ! '>='
252
+ - - '>='
164
253
  - !ruby/object:Gem::Version
165
254
  version: '0'
166
255
  required_rubygems_version: !ruby/object:Gem::Requirement
167
- none: false
168
256
  requirements:
169
- - - ! '>='
257
+ - - '>='
170
258
  - !ruby/object:Gem::Version
171
259
  version: '0'
172
260
  requirements: []
173
261
  rubyforge_project:
174
- rubygems_version: 1.8.10
262
+ rubygems_version: 2.0.3
175
263
  signing_key:
176
- specification_version: 3
264
+ specification_version: 4
177
265
  summary: OmniAuth strategy for Exvo
178
266
  test_files: []
179
267
  has_rdoc: