Class: RedditApi::Posts

Inherits:
Object
  • Object
show all
Defined in:
lib/reddit_api/posts.rb

Instance Method Summary collapse

Constructor Details

#initializePosts

Returns a new instance of Posts.



5
6
7
8
9
# File 'lib/reddit_api/posts.rb', line 5

def initialize
  @client = RedditApi::Client.new
  @post_factory = RedditApi::Post
  @query_factory =  RedditApi::Query
end

Instance Method Details

#top(subreddit, count) ⇒ Object



11
12
13
14
15
16
# File 'lib/reddit_api/posts.rb', line 11

def top(subreddit, count)
  posts_data = top_data(subreddit, count)
  posts_data = map_to_params(posts_data)
  posts_data = filter_out(posts_data, :stickied_posts)
  build_all_posts(posts_data)
end