Sha256: 9a88fabcdd2920810270ad13b55ea3d7cd13558752d2e233271ecf5be9583981

Contents?: true

Size: 427 Bytes

Versions: 2

Compression:

Stored size: 427 Bytes

Contents

module HackernewsApi
  class PollOpt
    def self.fetch id
      json = Client.fetch(:item, id)
      new(json)
    end

    attr_reader :id, :by, :parent, :score, :time, :type, :text

    def initialize json
      @id     = json['id']
      @by     = json['by']
      @time   = DateTime.strptime(json['time'].to_s, '%s')
      @type   = json['type']
      @parent = json['parent']
      @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_opt.rb
hackernews_api-0.0.1 lib/hackernews_api/poll_opt.rb