Sha256: 048354f1d689e733e9ef41d6954a8adedcec5ed5546b333ccf510eff6ac6c1b1
Contents?: true
Size: 491 Bytes
Versions: 2
Compression:
Stored size: 491 Bytes
Contents
module HackernewsApi class Poll def self.fetch id json = Client.fetch(:item, id) new(json) end attr_reader :id, :by, :kids, :score, :time, :title, :type, :text def initialize json @id = json['id'] @by = json['by'] @kids = json['kids'] @score = json['score'] @time = DateTime.strptime(json['time'].to_s, '%s') @title = json['title'] @type = json['type'] @text = json['text'] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hackernews_api-0.0.2 | lib/hackernews_api/poll.rb |
hackernews_api-0.0.1 | lib/hackernews_api/poll.rb |