mikedamage-tweeb 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/tweeb_search.rb +8 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/lib/tweeb_search.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
require "httparty"
|
3
|
+
require "mash"
|
3
4
|
require File.join(File.dirname(__FILE__), "tweeb_search_error.rb")
|
4
5
|
|
5
6
|
module Tweeb
|
@@ -8,6 +9,8 @@ module Tweeb
|
|
8
9
|
base_uri "http://search.twitter.com"
|
9
10
|
format :json
|
10
11
|
|
12
|
+
@@masher = lambda {|hash| Mash.new(hash) }
|
13
|
+
|
11
14
|
def search(query, options={})
|
12
15
|
if options.empty?
|
13
16
|
json = self.class.get("/search.json", :query => {:q => query})
|
@@ -20,23 +23,27 @@ module Tweeb
|
|
20
23
|
end
|
21
24
|
json = self.class.get("/search.json", :query => {:q => query}.merge(options))
|
22
25
|
end
|
23
|
-
|
26
|
+
@@masher.call(json)
|
24
27
|
end
|
25
28
|
|
26
29
|
def trends
|
27
30
|
json = self.class.get("/trends.json")
|
31
|
+
@@masher.call(json)
|
28
32
|
end
|
29
33
|
|
30
34
|
def current_trends
|
31
35
|
json = self.class.get("/trends/current.json")
|
36
|
+
@@masher.call(json)
|
32
37
|
end
|
33
38
|
|
34
39
|
def daily_trends
|
35
40
|
json = self.class.get("/trends/daily.json")
|
41
|
+
@@masher.call(json)
|
36
42
|
end
|
37
43
|
|
38
44
|
def weekly_trends
|
39
45
|
json = self.class.get("/trends/weekly.json")
|
46
|
+
@@masher.call(json)
|
40
47
|
end
|
41
48
|
end
|
42
49
|
end
|