Class: Tweeb::Search
Constant Summary collapse
- @@masher =
lambda {|hash| Mash.new(hash) }
Instance Method Summary collapse
- #current_trends ⇒ Object
- #daily_trends ⇒ Object
- #search(query, options = {}) ⇒ Object
- #trends ⇒ Object
- #weekly_trends ⇒ Object
Instance Method Details
#current_trends ⇒ Object
34 35 36 37 |
# File 'lib/tweeb_search.rb', line 34 def current_trends json = self.class.get("/trends/current.json") @@masher.call(json) end |
#daily_trends ⇒ Object
39 40 41 42 |
# File 'lib/tweeb_search.rb', line 39 def daily_trends json = self.class.get("/trends/daily.json") @@masher.call(json) end |
#search(query, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tweeb_search.rb', line 14 def search(query, ={}) if .empty? json = self.class.get("/search.json", :query => {:q => query}) else if [:rpp] && [:rpp] > 100 raise Tweeb::SearchError, "rpp parameter must be < 100" end if [:rpp] && [:page] && ([:rpp] * [:page]) > 1500 raise Tweeb::SearchError, "A maximum of 1500 tweets can be returned. Either lower rpp, or lower page options." end json = self.class.get("/search.json", :query => {:q => query}.merge()) end @@masher.call(json) end |
#trends ⇒ Object
29 30 31 32 |
# File 'lib/tweeb_search.rb', line 29 def trends json = self.class.get("/trends.json") @@masher.call(json) end |
#weekly_trends ⇒ Object
44 45 46 47 |
# File 'lib/tweeb_search.rb', line 44 def weekly_trends json = self.class.get("/trends/weekly.json") @@masher.call(json) end |