oauth-plugin 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,6 @@
1
1
  7/21/2009
2
- - made a github gem
2
+ - Twitter, Agree2 and FireEagle tokens are working in consumer.
3
+ - made it a gem
3
4
  - more thorough tests of OAuth 1.0 consumer
4
5
  - Add support for a OAUTH_10_SUPPORT constant to switch on support for OAuth 1.0 in provider
5
6
  7/19/2009
@@ -24,12 +24,12 @@ You need to install the oauth gem (0.3.5) which is the core OAuth ruby library.
24
24
 
25
25
  The plugin can now be installed as an gem from github, which is the easiest way to keep it up to date.
26
26
 
27
- sudo gem install pelle-oauth-plugin
27
+ sudo gem install oauth-plugin
28
28
 
29
29
  You should add the following in the gem dependency section of environment.rb
30
30
 
31
31
  config.gem "oauth"
32
- config.gem "pelle-oauth-plugin", :source => "http://gems.github.com"
32
+ config.gem "oauth-plugin"
33
33
 
34
34
  Alternatively you can install it in vendors/plugin:
35
35
 
@@ -319,7 +319,7 @@ This allows you to add a has_one association in your user model:
319
319
 
320
320
  And you could do:
321
321
 
322
- @location=@user.fire_eagle.client.get "/api/0.1/user.json"
322
+ @location=@user.fire_eagle.client.location
323
323
 
324
324
  The client method gives you a OAuth::AccessToken which you can use to perform rest operations on the client site - see http://oauth.rubyforge.org/rdoc/classes/OAuth/AccessToken.html
325
325
 
@@ -327,9 +327,10 @@ The client method gives you a OAuth::AccessToken which you can use to perform re
327
327
 
328
328
  Before creating the FireEagleToken model the plugin checks if a class already exists by that name or if we provide an api wrapper for it. This allows you to create a better token model that uses an existing ruby gem.
329
329
 
330
- Currently we provide the following untested tokens:
330
+ Currently we provide the following semi tested tokens wrappers:
331
331
 
332
- * Twitter (Will work when the twitter gem is updated to support OAuth 0.3.5)
332
+ * FireEagle
333
+ * Twitter (requires Paul Singh's version of twitter gem until main gem is updated to 0.3.5 - sudo gem install paulsingh-twitter)
333
334
  * Agree2
334
335
 
335
336
  These can be found in lib/oauth/models/consulers/services. Contributions will be warmly accepted for your favorite OAuth service.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.5
1
+ 0.3.6
@@ -12,6 +12,10 @@
12
12
  # :key=>"",
13
13
  # :secret=>""
14
14
  # },
15
+ # :fireeagle=>{
16
+ # :key=>"",
17
+ # :secret=>""
18
+ # },
15
19
  # :hour_feed=>{
16
20
  # :key=>"",
17
21
  # :secret=>"",
@@ -1,11 +1,12 @@
1
1
  require 'agree2'
2
2
  class Agree2Token < ConsumerToken
3
- def self.agree2_client
4
- @agree2_client||=Agree2::Client.new OAUTH_CREDENTIALS[:agree2][:key],OAUTH_CREDENTIALS[:agree2][:secret]
3
+ AGREE2_SETTINGS={:site=>"https://agree2.com"}
4
+ def self.consumer
5
+ @consumer||=OAuth::Consumer.new credentials[:key],credentials[:secret],AGREE2_SETTINGS
5
6
  end
6
7
 
7
- def self.consumer
8
- agree2_client.consumer
8
+ def self.agree2_client
9
+ @agree2_client||=Agree2::Client.new credentials[:key],credentials[:secret]
9
10
  end
10
11
 
11
12
  def client
@@ -0,0 +1,39 @@
1
+ require 'fireeagle'
2
+ # For more information on FireEagle
3
+ # http://fireeagle.rubyforge.org/
4
+ class FireeagleToken < ConsumerToken
5
+ FIREEAGLE_SETTINGS={
6
+ :site=>"https://fireeagle.yahooapis.com",
7
+ :authorize_url=>"https://fireeagle.yahoo.net/oauth/authorize"}
8
+
9
+ def self.consumer
10
+ @consumer||=OAuth::Consumer.new credentials[:key],credentials[:secret],FIREEAGLE_SETTINGS
11
+ end
12
+
13
+ def client
14
+ @client||=FireEagle::Client.new :consumer_key => FireeagleToken.consumer.key,
15
+ :consumer_secret => FireeagleToken.consumer.secret,
16
+ :access_token => token,
17
+ :access_token_secret => secret
18
+ end
19
+
20
+ # Returns the FireEagle User object
21
+ # http://fireeagle.rubyforge.org/classes/FireEagle/User.html
22
+ def fireeagle_user
23
+ @fireeagle_user||=client.user
24
+ end
25
+
26
+ # gives you the best guess of a location for user.
27
+ # This returns the FireEagle Location object:
28
+ # http://fireeagle.rubyforge.org/classes/FireEagle/Location.html
29
+ def location
30
+ fireeagle_user.best_guess.name
31
+ end
32
+
33
+ # Updates thes users location
34
+ # see: http://fireeagle.rubyforge.org/classes/FireEagle/Client.html#M000026
35
+ def update_location(location={})
36
+ client.update(location)
37
+ end
38
+ end
39
+
@@ -1,17 +1,16 @@
1
+ gem 'paulsingh-twitter' # go back to regular twitter gem when it is bumped to oauth 0.3.5
1
2
  require 'twitter'
2
3
  class TwitterToken < ConsumerToken
3
- def self.twitter
4
- @twitter||=Twitter::OAuth.new( OAUTH_CREDENTIALS[:twitter][:key],OAUTH_CREDENTIALS[:twitter][:secret]).consumer
5
- end
6
-
4
+ TWITTER_SETTINGS={:site=>"http://twitter.com"}
7
5
  def self.consumer
8
- @twitter.consumer
6
+ @consumer||=OAuth::Consumer.new credentials[:key],credentials[:secret],TWITTER_SETTINGS
9
7
  end
10
8
 
11
9
  def client
12
10
  unless @client
13
- @client=TwitterToken.twitter.clone
14
- @client.authorize_from_access token,secret
11
+ @twitter_oauth=Twitter::OAuth.new TwitterToken.consumer.key,TwitterToken.consumer.secret
12
+ @twitter_oauth.authorize_from_access token,secret
13
+ @client=Twitter::Base.new(@twitter_oauth)
15
14
  end
16
15
 
17
16
  @client
@@ -37,7 +37,7 @@ module Oauth
37
37
  create :user_id=>user.id,:token=>access_token.token,:secret=>access_token.secret
38
38
  end
39
39
 
40
- private
40
+ protected
41
41
 
42
42
  def credentials
43
43
  @credentials||=OAUTH_CREDENTIALS[service_name]
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{oauth-plugin}
5
- s.version = "0.3.5"
5
+ s.version = "0.3.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Pelle Braendgaard"]
@@ -76,6 +76,7 @@ Gem::Specification.new do |s|
76
76
  "lib/oauth/controllers/provider_controller.rb",
77
77
  "lib/oauth/models/consumers/service_loader.rb",
78
78
  "lib/oauth/models/consumers/services/agree2_token.rb",
79
+ "lib/oauth/models/consumers/services/fireeagle_token.rb",
79
80
  "lib/oauth/models/consumers/services/twitter_token.rb",
80
81
  "lib/oauth/models/consumers/token.rb",
81
82
  "oauth-plugin.gemspec",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oauth-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pelle Braendgaard
@@ -94,6 +94,7 @@ files:
94
94
  - lib/oauth/controllers/provider_controller.rb
95
95
  - lib/oauth/models/consumers/service_loader.rb
96
96
  - lib/oauth/models/consumers/services/agree2_token.rb
97
+ - lib/oauth/models/consumers/services/fireeagle_token.rb
97
98
  - lib/oauth/models/consumers/services/twitter_token.rb
98
99
  - lib/oauth/models/consumers/token.rb
99
100
  - oauth-plugin.gemspec