Class: HnApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/hn-api/client.rb

Constant Summary collapse

URI =

Base URI for the HN API

"http://api.ihackernews.com/"

Instance Method Summary collapse

Instance Method Details

#latestObject

Retrieve the latest posts from HN API, and transform into an object-like response with Hashie.



8
9
10
11
# File 'lib/hn-api/client.rb', line 8

def latest
  content = connection.get("/page").body
  Hashie::Mash.new(content)
end