Class: HackernewsApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/hackernews_api/client.rb

Class Method Summary collapse

Class Method Details

.fetch(entity_type, id) ⇒ Object



5
6
7
8
# File 'lib/hackernews_api/client.rb', line 5

def self.fetch(entity_type, id)
  raw_json = RestClient.get("#{HackernewsApi::API_URL}/#{HackernewsApi::API_VERSION}/#{entity_type.to_s}/#{id}.json?print=pretty")
  JSON.parse(raw_json)
end