szimek-twitter_rails 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 3
4
+ :patch: 4
@@ -14,7 +14,7 @@ module Twitter
14
14
  request_access_token if request_token_available?
15
15
 
16
16
  if access_token_available?
17
- twitter_oauth.authorize_from_access(session['twitter_atoken'], session['twitter_asecret'])
17
+ twitter_oauth.authorize_from_access(session[:twitter_atoken], session[:twitter_asecret])
18
18
  @twitter_session = Twitter::Base.new(twitter_oauth)
19
19
  end
20
20
  end
@@ -41,21 +41,25 @@ module Twitter
41
41
  end
42
42
 
43
43
  def request_access_token
44
- oauth = self.twitter_oauth
45
- oauth.authorize_from_request(session['twitter_rtoken'], session['twitter_rsecret'])
44
+ begin
45
+ oauth = self.twitter_oauth
46
+ oauth.authorize_from_request(session[:twitter_rtoken], session[:twitter_rsecret])
46
47
 
47
- session['twitter_rtoken'] = nil
48
- session['twitter_rsecret'] = nil
49
- session['twitter_atoken'] = oauth.access_token.token
50
- session['twitter_asecret'] = oauth.access_token.secret
48
+ session[:twitter_atoken] = oauth.access_token.token
49
+ session[:twitter_asecret] = oauth.access_token.secret
50
+ rescue ::OAuth::Unauthorized
51
+ ensure
52
+ session[:twitter_rtoken] = nil
53
+ session[:twitter_rsecret] = nil
54
+ end
51
55
  end
52
56
 
53
57
  def request_token_available?
54
- session['twitter_rtoken'] && session['twitter_rsecret']
58
+ session[:twitter_rtoken] && session[:twitter_rsecret]
55
59
  end
56
60
 
57
61
  def access_token_available?
58
- session['twitter_atoken'] && session['twitter_asecret']
62
+ session[:twitter_atoken] && session[:twitter_asecret]
59
63
  end
60
64
 
61
65
  def twitter_oauth
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: szimek-twitter_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Szymon Nowak
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-20 00:00:00 -07:00
12
+ date: 2009-04-22 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15