module Twumper::Search
Constants
- BASE_URL
- DEFAULT_OPTIONS
Public Instance Methods
search(keyword, options=DEFAULT_OPTIONS)
click to toggle source
# File lib/twumper/search.rb, line 12 def search(keyword, options=DEFAULT_OPTIONS) tweets = Array.new while tweets.count < options[:limit] url = "#{BASE_URL}?q=#{keyword}&result_type=#{options[:result_type]}&count=#{options[:count]}" url += "&max_id=#{options[:max_id]}" if !options[:max_id].nil? headers = set_headers response = connection.get(url, headers: headers) tweets += response['statuses'] options[:max_id] = tweets.last['id'] end tweets end