lib/reddit/reddit.rb in bterlson-reddit-0.2.0 vs lib/reddit/reddit.rb in bterlson-reddit-0.2.1

- old
+ new

@@ -7,12 +7,28 @@ def initialize(name = nil) @name = name @url = @name.nil? ? BASE_URL : SUBREDDIT_URL.gsub('[subreddit]', @name) end + def hot + articles 'hot' + end + + def top + articles 'top' + end + + def new + articles 'new' + end + + def controversial + articles 'controversial' + end + # Returns the articles found in this reddit. - def articles - resources = get_resources(@url) + def articles(page = 'hot') + resources = get_resources("#{@url}#{page}/") articles = [] resources.each do |article| articles << Article.new(article['data']) \ No newline at end of file