Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added further [doc] of the attr_readers of HN Entities.

  • Loading branch information...
commit be4d2c1701a91baedae007e8e084b333ee490e74 1 parent 3b8f4d0
@jcla1 authored
Showing with 35 additions and 3 deletions.
  1. +34 −3 lib/hn2json/entity.rb
  2. +1 −0  lib/hn2json/version.rb
View
37 lib/hn2json/entity.rb
@@ -1,9 +1,40 @@
module HN2JSON
-
+ # Internal: Represents a post, poll, discussion or comment on HackerNews.
class Entity
- attr_accessor :type, :id, :parent, :url, :title, :comments, :votes
- attr_accessor :fulltext, :posted_by, :date_posted, :voting_on
+ # Public: Returns the IDs of all top-level comments.
+ attr_reader :comments
+
+ # Public: Returns the String date when the Entity was posted to HackerNews.
+ attr_reader :date_posted
+
+ # Public: Return the String text of the Entity, if available.
+ attr_reader :fulltext
+
+ # Public: Returns the Integer ID of the Entity
+ attr_reader :id
+
+ # Public: Returns the Integer ID of the parent, if available
+ attr_reader :parent
+
+ # Public: Returns the String username of the user who posted the Entity
+ attr_reader :posted_by
+
+ # Public: Returns the String title of the Entity, if available
+ attr_reader :title
+
+ # Public: Returns the Symbol type of the Entity (:post, :poll, :discussion, :comment)
+ attr_reader :type
+
+ # Public: Returns the String url of an Entity, if available
+ attr_reader :url
+
+ # Public: Returns the Interger number of upvotes the Entity has recieved
+ attr_reader :votes
+
+ # Public: Returns a 2D Array of ["Thing you're voting on", number of upvotes]
+ attr_reader :voting_on
+
def initialize id
@id = id
View
1  lib/hn2json/version.rb
@@ -1,3 +1,4 @@
module HN2JSON
+ # Public: String current version of HN2JSON
VERSION = '0.0.4'
end

0 comments on commit be4d2c1

Please sign in to comment.
Something went wrong with that request. Please try again.