rack-twitter-auth 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/Rakefile +2 -2
  2. data/VERSION +1 -1
  3. data/lib/rack-oauth.rb +9 -5
  4. metadata +2 -2
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake/rdoctask'
4
4
  require 'spec/rake/spectask'
5
5
 
6
- puts "\nGem: rack-oauth\n\n"
6
+ puts "\nGem: rack-twitter-auth\n\n"
7
7
 
8
8
  begin
9
9
  require 'jeweler'
@@ -13,7 +13,7 @@ begin
13
13
  s.email = ['remi@remitaylor.com', 'brianthecoder@gmail.com']
14
14
  s.homepage = 'http://github.com/remi/rack-twitter-auth'
15
15
  s.description = 'Rack Middleware for OAuth Authorization and Authentication via/twitter'
16
- s.authors = %w( remi brianthecoder)
16
+ s.authors = %w(remi brianthecoder)
17
17
  s.files = FileList['[A-Z]*', '{lib,spec,bin,examples}/**/*']
18
18
  s.add_dependency 'oauth'
19
19
  s.add_dependency 'rack'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.2.0
@@ -64,7 +64,7 @@ module Rack #:nodoc:
64
64
 
65
65
  # Returns the instance of Rack::OAuth given a name (defaults to the default Rack::OAuth name)
66
66
  def oauth_instance name = nil
67
- oauth = Rack::OAuth.get(oauth_request_env, nil)
67
+ oauth = Rack::OAuth.get(oauth_request_env, name)
68
68
  raise "Couldn't find Rack::OAuth instance with name #{ name }" unless oauth
69
69
  oauth
70
70
  end
@@ -122,9 +122,14 @@ module Rack #:nodoc:
122
122
  def callback_path
123
123
  ::File.join *[@callback_path.to_s, name_unless_default].compact
124
124
  end
125
+
125
126
  attr_writer :callback_path
126
127
  alias callback callback_path
127
128
  alias callback= callback_path=
129
+
130
+ def redirect_path
131
+ ::File.join *[@redirect_to.to_s, name_unless_default].compact
132
+ end
128
133
 
129
134
  # the URL that Rack::OAuth should redirect to after the OAuth has been completed (part of your app)
130
135
  attr_accessor :redirect_to
@@ -156,6 +161,7 @@ module Rack #:nodoc:
156
161
  def name
157
162
  @name.to_s
158
163
  end
164
+
159
165
  attr_writer :name
160
166
 
161
167
  def initialize app, *args
@@ -183,13 +189,11 @@ module Rack #:nodoc:
183
189
  # the provider will redirect back to our application's callback path
184
190
  when login_path
185
191
  do_login(env)
186
-
187
192
  # the oauth provider has redirected back to us! we should have a
188
193
  # verifier now that we can use, in combination with out token and
189
194
  # secret, to get an access token for this user
190
195
  when callback_path
191
196
  do_callback(env)
192
-
193
197
  else
194
198
  @app.call(env)
195
199
  end
@@ -222,7 +226,7 @@ module Rack #:nodoc:
222
226
  session(env).delete(:secret)
223
227
 
224
228
  # we have an access token now ... redirect back to the user's application
225
- [ 302, { 'Content-Type' => 'text/html', 'Location' => redirect_to }, [] ]
229
+ [ 302, { 'Content-Type' => 'text/html', 'Location' => redirect_path }, [] ]
226
230
  end
227
231
 
228
232
  # Stores the access token in this env's session in a way that we can get it back out via #get_access_token(env)
@@ -286,4 +290,4 @@ module Rack #:nodoc:
286
290
 
287
291
  end
288
292
 
289
- end
293
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-twitter-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - remi
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-02-22 00:00:00 -06:00
13
+ date: 2010-03-05 00:00:00 -06:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency