Class: Sapphire::HTTPartyReddit

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/apiclients/httparty.rb

Instance Method Summary collapse

Constructor Details

#initializeHTTPartyReddit

Returns a new instance of HTTPartyReddit.



7
8
9
# File 'lib/apiclients/httparty.rb', line 7

def initialize
  @options = { query: { limit: 10, sort: 'hot' } }
end

Instance Method Details

#get_posts(subreddit) ⇒ Object



11
12
13
14
# File 'lib/apiclients/httparty.rb', line 11

def get_posts(subreddit)
  response = self.class.get("/r/#{subreddit}/hot.json", @options)
  parse_response(response)
end