Browse files

Merge pull request #13 from BukhariH/Search

Add :sort to search.
  • Loading branch information...
2 parents 6948677 + 346cf04 commit 13a7d08c82572493e3e8d075f9fcd8a6b2491518 Sam Symons committed Jan 6, 2014
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/redditkit/client/search.rb
View
3 lib/redditkit/client/search.rb
@@ -10,12 +10,13 @@ module Search
# @option options [true, false] :restrict_to_subreddit Whether to search only in a specified subreddit.
# @option options [String, RedditKit::Subreddit] :subreddit The optional subreddit to search.
# @option options [1..100] limit The number of links to return.
+ # @option options [String] the order in which to return results which is one of (relevance, new, hot, top, comments)
# @option options [String] before Only return links before this full name.
# @option options [String] after Only return links after this full name.
# @return [RedditKit::PaginatedResponse]
def search(query, options = {})
path = "%s/search.json" % ('r/' + options[:subreddit] if options[:subreddit])
- parameters = { :q => query, :restrict_sr => options[:restrict_to_subreddit], :limit => options[:limit] }
+ parameters = { :q => query, :restrict_sr => options[:restrict_to_subreddit], :limit => options[:limit], :sort => options[:sort] }
objects_from_response(:get, path, parameters)
end

0 comments on commit 13a7d08

Please sign in to comment.