Class: Tweeb::Search

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/tweeb_search.rb

Instance Method Summary collapse

Instance Method Details



30
31
32
# File 'lib/tweeb_search.rb', line 30

def current_trends
	json = self.class.get("/trends/current.json")
end


34
35
36
# File 'lib/tweeb_search.rb', line 34

def daily_trends
	json = self.class.get("/trends/daily.json")
end

#search(query, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tweeb_search.rb', line 11

def search(query, options={})
	if options.empty?
		json = self.class.get("/search.json", :query => {:q => query})
	else
		if options[:rpp] && options[:rpp] > 100
			raise Tweeb::SearchError, "rpp parameter must be < 100"
		end
		if options[:rpp] && options[:page] && (options[:rpp] * options[: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(options))
	end
	return json
end


26
27
28
# File 'lib/tweeb_search.rb', line 26

def trends
	json = self.class.get("/trends.json")
end


38
39
40
# File 'lib/tweeb_search.rb', line 38

def weekly_trends
	json = self.class.get("/trends/weekly.json")
end