MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeText-parser / RedditKit

Class RedditKit

tests/test_parser/test_sample/ruby_test_sample.rb:1–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1module RedditKit
2 class Client < API
3
4 # Methods for searching reddit's links.
5 module Search
6
7 # Search for links.
8 #
9 # @param query [String] The search query.
10 # @option options [String, RedditKit::Subreddit] subreddit The optional subreddit to search.
11 # @option options [true, false] restrict_to_subreddit Whether to search only in a specified subreddit.
12 # @option options [1..100] limit The number of links to return.
13 # @option options [String] count The number of results to return before or after. This is different from `limit`.
14 # @option options [relevance, new, hot, top, comments] sort The sorting order for search results.
15 # @option options [String] before Only return links before this full name.
16 # @option options [String] after Only return links after this full name.
17 # @option options [cloudsearch, lucene, plain] syntax Specify the syntax for the search. Learn more: http://www.reddit.com/r/redditdev/comments/1hpicu/whats_this_syntaxcloudsearch_do/cawm0fe
18 # @option options [hour, day, week, month, year, all] time Show results with a specific time period.
19 # @return [RedditKit::PaginatedResponse]
20 def search(query, options = {})
21 path = "%s/search.json" % ('r/' + options[:subreddit] if options[:subreddit])
22 parameters = { :q => query,
23 :restrict_sr => options[:restrict_to_subreddit],
24 :limit => options[:limit],
25 :count => options[:count],
26 :sort => options[:sort],
27 :before => options[:before],
28 :after => options[:after],
29 :syntax => options[:syntax],
30 :t => options[:time]
31 }
32
33 objects_from_response(:get, path, parameters)
34 end
35
36 def self.my_method(a)
37 # Method implementation
38 puts(a)
39 return a
40 end
41
42 end
43 end
44end
45
46load_current_value do |new_resource, old_resource|
47 unless current_installed_version(new_resource).nil?

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected