szimek-twitter_rails 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -9,8 +9,8 @@ begin
9
9
  gem.email = "szymon.nowak@u2i.com"
10
10
  gem.homepage = "http://github.com/szimek/twitter_rails"
11
11
  gem.authors = ["Szymon Nowak"]
12
-
13
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
12
+
13
+ gem.add_dependency('jnunemaker-twitter', '>= 0.6.6')
14
14
  end
15
15
  rescue LoadError
16
16
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 4
4
+ :patch: 5
File without changes
@@ -0,0 +1,5 @@
1
+ Twitter::OAuth.class_eval do
2
+ def consumer
3
+ @consumer ||= ::OAuth::Consumer.new(@ctoken, @csecret, {:site => 'https://twitter.com', :authorize_path => '/oauth/authenticate'})
4
+ end
5
+ end
@@ -31,6 +31,8 @@ module Twitter
31
31
  end
32
32
 
33
33
  def clear_twitter_session_information
34
+ session[:twitter_rtoken] = nil
35
+ session[:twitter_rsecret] = nil
34
36
  session[:twitter_atoken] = nil
35
37
  session[:twitter_asecret] = nil
36
38
  end
@@ -44,11 +46,13 @@ module Twitter
44
46
  begin
45
47
  oauth = self.twitter_oauth
46
48
  oauth.authorize_from_request(session[:twitter_rtoken], session[:twitter_rsecret])
47
-
48
- session[:twitter_atoken] = oauth.access_token.token
49
- session[:twitter_asecret] = oauth.access_token.secret
49
+ @access_token = oauth.access_token
50
+ session[:twitter_atoken] = @access_token.token
51
+ session[:twitter_asecret] = @access_token.secret
50
52
  rescue ::OAuth::Unauthorized
51
53
  ensure
54
+ # The request token has been invalidated
55
+ # so we nullify it in the session.
52
56
  session[:twitter_rtoken] = nil
53
57
  session[:twitter_rsecret] = nil
54
58
  end
File without changes
@@ -8,6 +8,8 @@ module Twitter
8
8
  twitter_config = YAML.load(File.read(twitter_yaml_file))[RAILS_ENV]
9
9
  ENV['TWITTER_CONSUMER_TOKEN'] = twitter_config['token']
10
10
  ENV['TWITTER_CONSUMER_SECRET'] = twitter_config['secret']
11
+ else
12
+ raise "Twitter config file not present."
11
13
  end
12
14
  end
13
15
  end
data/lib/twitter_rails.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  if defined? Rails
2
- require 'twitter/base'
3
- require 'twitter/rails/controller'
4
- require 'twitter/rails/helpers'
5
- require 'twitter/rails/initializer'
2
+ %w(base oauth rails/controller rails/helpers rails/initializer).each do |file|
3
+ require File.join(File.dirname(__FILE__), "twitter_rails", file)
4
+ end
6
5
  end
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.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Szymon Nowak
@@ -9,10 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-22 00:00:00 -07:00
12
+ date: 2009-05-04 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: jnunemaker-twitter
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.6.6
24
+ version:
16
25
  description:
17
26
  email: szymon.nowak@u2i.com
18
27
  executables: []
@@ -27,11 +36,12 @@ files:
27
36
  - README.rdoc
28
37
  - Rakefile
29
38
  - VERSION.yml
30
- - lib/twitter/base.rb
31
- - lib/twitter/rails/controller.rb
32
- - lib/twitter/rails/helpers.rb
33
- - lib/twitter/rails/initializer.rb
34
39
  - lib/twitter_rails.rb
40
+ - lib/twitter_rails/base.rb
41
+ - lib/twitter_rails/oauth.rb
42
+ - lib/twitter_rails/rails/controller.rb
43
+ - lib/twitter_rails/rails/helpers.rb
44
+ - lib/twitter_rails/rails/initializer.rb
35
45
  - test/test_helper.rb
36
46
  - test/twitter_rails_test.rb
37
47
  has_rdoc: true