hn2json 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -0
- data/lib/hn2json/entity.rb +11 -11
- data/lib/hn2json/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
HN2JSON
|
2
|
+
=======
|
3
|
+
|
4
|
+
Check out the documentation at: [http://rdoc.info/github/jcla1/HN2JSON/frames/](http://rdoc.info/github/jcla1/HN2JSON/frames/)
|
5
|
+
|
6
|
+
```rb
|
7
|
+
item = HN2JSON.find 4623690
|
8
|
+
|
9
|
+
item.title
|
10
|
+
# => "HN2JSON: A ruby gem for HackerNews"
|
11
|
+
|
12
|
+
item.votes
|
13
|
+
# => 1
|
14
|
+
```
|
data/lib/hn2json/entity.rb
CHANGED
@@ -3,37 +3,37 @@ module HN2JSON
|
|
3
3
|
class Entity
|
4
4
|
|
5
5
|
# Public: Returns the IDs of all top-level comments.
|
6
|
-
|
6
|
+
attr_accessor :comments
|
7
7
|
|
8
8
|
# Public: Returns the String date when the Entity was posted to HackerNews.
|
9
|
-
|
9
|
+
attr_accessor :date_posted
|
10
10
|
|
11
11
|
# Public: Return the String text of the Entity, if available.
|
12
|
-
|
12
|
+
attr_accessor :fulltext
|
13
13
|
|
14
14
|
# Public: Returns the Integer ID of the Entity
|
15
|
-
|
15
|
+
attr_accessor :id
|
16
16
|
|
17
17
|
# Public: Returns the Integer ID of the parent, if available
|
18
|
-
|
18
|
+
attr_accessor :parent
|
19
19
|
|
20
20
|
# Public: Returns the String username of the user who posted the Entity
|
21
|
-
|
21
|
+
attr_accessor :posted_by
|
22
22
|
|
23
23
|
# Public: Returns the String title of the Entity, if available
|
24
|
-
|
24
|
+
attr_accessor :title
|
25
25
|
|
26
26
|
# Public: Returns the Symbol type of the Entity (:post, :poll, :discussion, :comment)
|
27
|
-
|
27
|
+
attr_accessor :type
|
28
28
|
|
29
29
|
# Public: Returns the String url of an Entity, if available
|
30
|
-
|
30
|
+
attr_accessor :url
|
31
31
|
|
32
32
|
# Public: Returns the Interger number of upvotes the Entity has recieved
|
33
|
-
|
33
|
+
attr_accessor :votes
|
34
34
|
|
35
35
|
# Public: Returns a 2D Array of ["Thing you're voting on", number of upvotes]
|
36
|
-
|
36
|
+
attr_accessor :voting_on
|
37
37
|
|
38
38
|
|
39
39
|
def initialize id
|
data/lib/hn2json/version.rb
CHANGED