Sha256: ab197f3561201b04602f05b1ca5ab30468f6039bdf74eeca2f1d35a4e5b35eb0
Contents?: true
Size: 786 Bytes
Versions: 1
Compression:
Stored size: 786 Bytes
Contents
module Reddit # The list of comments found for an article. class CommentList < ResourceList # Initializes a comments list. Takes the ID of the article for which the comments belong to. def initialize(article_id) @article_id = article_id @url = COMMENTS_URL.gsub('[id]', @article_id) end # returns the top level comments for the thread. def top_level(options = {}) get_resources(@url, :querystring => options[:querystring], :count => options[:count]) do |resource_json| comment = Comment.new(resource_json['data']) end end private # forward any method calls to the top level comments array. def method_missing(meth, *args, &block) top_level.send(meth, *args, &block) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bterlson-reddit-0.3.0 | lib/reddit/comment_list.rb |