twitter_oauth 0.2.1 → 0.2.2

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.
@@ -1,8 +1,14 @@
1
1
  h1. Twitter OAuth REST API client library for Ruby
2
2
 
3
- To make authorized requests with the client library you'll need to [create a Twitter OAuth Application](http://twitter.com/oauth_clients/new).
3
+ h2. Install the gem
4
4
 
5
- See [sinitter](http://github.com/moomerman/sinitter/tree/master) for a full website integration example.
5
+ sudo gem install twitter_oauth # (via gemcutter)
6
+
7
+ h2. Using the gem
8
+
9
+ To make authorized requests with the client library you'll need to "create a Twitter OAuth Application":http://twitter.com/oauth_clients/new.
10
+
11
+ See "sinitter":http://github.com/moomerman/sinitter/tree/master for a full website integration example.
6
12
 
7
13
  h2. Unauthorized request example
8
14
 
@@ -38,7 +44,7 @@ when you set up your application.
38
44
  :consumer_secret => 'YOURA_APP_CONSUMER_SECRET'
39
45
  )
40
46
  request_token = client.request_token(:oauth_callback => oauth_confirm_url)
41
- #:oauth_callback required for web apps, since oauth gem by default forse PIN-based flow
47
+ #:oauth_callback required for web apps, since oauth gem by default force PIN-based flow
42
48
  #( see http://groups.google.com/group/twitter-development-talk/browse_thread/thread/472500cfe9e7cdb9/848f834227d3e64d )
43
49
 
44
50
 
@@ -9,6 +9,7 @@ require 'twitter_oauth/friendships'
9
9
  require 'twitter_oauth/user'
10
10
  require 'twitter_oauth/favorites'
11
11
  require 'twitter_oauth/utils'
12
+ require 'twitter_oauth/trends'
12
13
 
13
14
  module TwitterOAuth
14
15
  class Client
@@ -13,6 +13,24 @@ module TwitterOAuth
13
13
  search_result.results = search_result.results.collect{|x| OpenStruct.new(x)}
14
14
  search_result
15
15
  end
16
-
16
+
17
+ # Returns the current top 10 trending topics on Twitter.
18
+ def current_trends
19
+ response = open("http://search.twitter.com/trends/current.json")
20
+ JSON.parse(response.read)
21
+ end
22
+
23
+ # Returns the top 20 trending topics for each hour in a given day.
24
+ def daily_trends
25
+ response = open("http://search.twitter.com/trends/daily.json")
26
+ JSON.parse(response.read)
27
+ end
28
+
29
+ # Returns the top 30 trending topics for each day in a given week.
30
+ def weekly_trends
31
+ response = open("http://search.twitter.com/trends/weekly.json")
32
+ JSON.parse(response.read)
33
+ end
34
+
17
35
  end
18
36
  end
@@ -0,0 +1,11 @@
1
+ module TwitterOAuth
2
+ class Client
3
+
4
+ # Returns the top ten topics that are currently trending on Twitter.
5
+ def trends
6
+ oauth_response = access_token.get("/trends.json")
7
+ JSON.parse(oauth_response.body)
8
+ end
9
+
10
+ end
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter_oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Taylor
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.3.1
23
+ version: 0.3.6
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.2
33
+ version: 1.1.9
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: mime-types
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: "1.15"
43
+ version: "1.16"
44
44
  version:
45
45
  description: twitter_oauth is a Ruby library for talking to twitter using the new oauth method.
46
46
  email: moomerman@gmail.com
@@ -53,17 +53,18 @@ extra_rdoc_files: []
53
53
  files:
54
54
  - README.textile
55
55
  - lib/twitter_oauth.rb
56
- - lib/twitter_oauth/client.rb
57
- - lib/twitter_oauth/timeline.rb
58
56
  - lib/twitter_oauth/account.rb
59
- - lib/twitter_oauth/status.rb
60
- - lib/twitter_oauth/direct_messages.rb
61
- - lib/twitter_oauth/search.rb
62
57
  - lib/twitter_oauth/blocks.rb
58
+ - lib/twitter_oauth/client.rb
59
+ - lib/twitter_oauth/direct_messages.rb
60
+ - lib/twitter_oauth/favorites.rb
63
61
  - lib/twitter_oauth/friendships.rb
64
62
  - lib/twitter_oauth/notifications.rb
63
+ - lib/twitter_oauth/search.rb
64
+ - lib/twitter_oauth/status.rb
65
+ - lib/twitter_oauth/timeline.rb
66
+ - lib/twitter_oauth/trends.rb
65
67
  - lib/twitter_oauth/user.rb
66
- - lib/twitter_oauth/favorites.rb
67
68
  - lib/twitter_oauth/utils.rb
68
69
  has_rdoc: true
69
70
  homepage: http://github.com/moomerman/twitter_oauth