moomerman-twitter_oauth 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -16,6 +16,15 @@ puts client.show('twitter')
16
16
  => => {"status"=>{"truncated"=>false, "favorited"=>false, "text"=>"Update on service issues http://tinyurl.com/ca872j", "id"=>1357776683, "in_reply_to_user_id"=>nil, "in_reply_to_status_id"=>nil, "source"=>"<a href=\"http://twitterfeed.com\">twitterfeed</a>", "created_at"=>"Fri Mar 20 01:17:35 +0000 2009"}, "name"=>"Twitter", "profile_sidebar_fill_color"=>"CDFFFF", "profile_sidebar_border_color"=>"8a6447", "profile_background_tile"=>false, "profile_link_color"=>"0000ff", "url"=>"http://twitter.com", "favourites_count"=>0, "id"=>783214, "description"=>"Always wondering what everyone's doing.", "profile_text_color"=>"000000", "protected"=>false, "utc_offset"=>-28800, "screen_name"=>"twitter", "profile_background_color"=>"9ae4e8", "time_zone"=>"Pacific Time (US & Canada)", "followers_count"=>469150, "profile_background_image_url"=>"http://static.twitter.com/images/themes/theme1/bg.gif", "friends_count"=>30, "statuses_count"=>290, "location"=>"San Francisco, CA", "profile_image_url"=>"http://s3.amazonaws.com/twitter_production/profile_images/75075164/twitter_bird_profile_normal.png", "created_at"=>"Tue Feb 20 14:35:54 +0000 2007"}
17
17
  </code></pre>
18
18
 
19
+ You can also access to the search API which is available in either authorized or unauthorized modes.
20
+
21
+ <pre><code>search = client.search('twitter')
22
+ search.results.size => 20
23
+ search.results.first.from_user => "josephpred"
24
+ search.results.first.text
25
+ => "Useful public service Twitter account for those of you hitting Tahoe or just needing to cross the pass to Reno: @i80chains"
26
+ </code></pre>
27
+
19
28
  h2. Authorized request example
20
29
 
21
30
  To use the full power of the Twitter API you need to authorize your application and a valid Twitter user via OAuth.
@@ -5,7 +5,7 @@ module TwitterOAuth
5
5
  class Client
6
6
 
7
7
  def search(q, page = 1, per_page = 20)
8
- response = open("http://search.twitter.com/search.json?q=#{q}&page=#{page}&rpp=#{per_page}")
8
+ response = open("http://search.twitter.com/search.json?q=#{URI.escape(q)}&page=#{page}&rpp=#{per_page}")
9
9
  search_result = JSON.parse(response.read)
10
10
  search_result = OpenStruct.new(search_result)
11
11
  search_result.results = search_result.results.collect{|x| OpenStruct.new(x)}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moomerman-twitter_oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Taylor