ruby-hackernews 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +20 -15
- data/Rakefile +1 -1
- data/lib/{HNAPI → ruby-hackernews}/domain/comment/comment.rb +0 -1
- data/lib/{HNAPI → ruby-hackernews}/domain/entry/comments_info.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/domain/entry/entry.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/domain/entry/link_info.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/domain/entry/time_info.rb +2 -2
- data/lib/{HNAPI → ruby-hackernews}/domain/entry/user_info.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/domain/entry/voting_info.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/domain/user.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/comment_service.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/configuration_service.rb +5 -1
- data/lib/{HNAPI → ruby-hackernews}/services/entry_service.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/login_service.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/mechanize_context.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/not_authenticated_error.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/parsers/comments_info_parser.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/parsers/entry_page_parser.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/parsers/entry_parser.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/parsers/link_info_parser.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/parsers/time_info_parser.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/parsers/user_info_parser.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/parsers/voting_info_parser.rb +0 -0
- data/lib/{HNAPI → ruby-hackernews}/services/voting_service.rb +0 -0
- data/lib/ruby-hackernews.rb +6 -2
- metadata +26 -26
data/README.rdoc
CHANGED
@@ -22,40 +22,40 @@ before using it.
|
|
22
22
|
|
23
23
|
You can get entries on the main page with:
|
24
24
|
|
25
|
-
Entry.all
|
25
|
+
Entry.all # returns the main page's entries as an array
|
26
26
|
|
27
27
|
You can provide a number of pages:
|
28
28
|
|
29
|
-
Entry.all(3)
|
29
|
+
Entry.all(3) # will return the entries on the first 3 pages
|
30
30
|
|
31
31
|
There are methods for getting specific entry types:
|
32
32
|
|
33
33
|
Entry.questions # gets the first page of questions (ask NH)
|
34
|
-
Entry.newest #
|
35
|
-
Entry.jobs #
|
34
|
+
Entry.newest # gets the first page of new links (new)
|
35
|
+
Entry.jobs # gets the first page of job offerts (jobs)
|
36
36
|
|
37
37
|
Each Entry instance has the following data:
|
38
38
|
|
39
|
-
entry = Entry.all.first #
|
39
|
+
entry = Entry.all.first # gets the top entry on the mainpage
|
40
40
|
|
41
|
-
entry.number # entry's position on HN
|
41
|
+
entry.number # the entry's position on HN
|
42
42
|
|
43
43
|
entry.link.title # the link's name on HN
|
44
44
|
entry.link.href # the actual link
|
45
|
-
entry.link.site # the referring
|
45
|
+
entry.link.site # the referring site, if any
|
46
46
|
|
47
47
|
entry.voting.score # the entry's score on HN
|
48
48
|
|
49
|
-
entry.user.name # submitter's user name
|
49
|
+
entry.user.name # the submitter's user name
|
50
50
|
|
51
|
-
entry.time # elapsed time from submission
|
51
|
+
entry.time # the elapsed time from submission
|
52
52
|
|
53
53
|
After you've logged in (see below) you can do the following
|
54
54
|
|
55
|
-
entry.upvote #votes the entry
|
56
|
-
entry.write_comment("mycomment") #adds a comment to the entry
|
57
|
-
Entry.submit("mytitle", "myurl") #submit a new link
|
58
|
-
Entry.submit("myquestion") #submit a new question (ask HN)
|
55
|
+
entry.upvote # votes the entry
|
56
|
+
entry.write_comment("mycomment") # adds a comment to the entry
|
57
|
+
Entry.submit("mytitle", "myurl") # submit a new link
|
58
|
+
Entry.submit("myquestion") # submit a new question (ask HN)
|
59
59
|
|
60
60
|
== Comments
|
61
61
|
|
@@ -66,7 +66,7 @@ You get an entry's comments with:
|
|
66
66
|
You can also get the newest comments on HN with:
|
67
67
|
|
68
68
|
Comments.newest
|
69
|
-
Comments.newest(3) #
|
69
|
+
Comments.newest(3) # gets the first 3 pages of new comments
|
70
70
|
|
71
71
|
Each Comment instance has the following data:
|
72
72
|
|
@@ -79,7 +79,7 @@ Each Comment instance has the following data:
|
|
79
79
|
Comments are enumerable and threaded, so you can do like:
|
80
80
|
|
81
81
|
comment[2][0] # gets the third reply to this comment, then the first reply to the reply
|
82
|
-
comment.first #
|
82
|
+
comment.first # gets the first reply to this comment
|
83
83
|
comment.select do |c| # gets all the comment replies which text contains "test"
|
84
84
|
text ~= /test/
|
85
85
|
end
|
@@ -112,3 +112,8 @@ You have to log out before logging in with a different user.
|
|
112
112
|
Get user info (submission, comments...)
|
113
113
|
Create account
|
114
114
|
Change user info/settings
|
115
|
+
|
116
|
+
== THANKS TO
|
117
|
+
|
118
|
+
- Mike Kelly ( https://github.com/mikekelly ) for fixing a bug in TimeInfo.time
|
119
|
+
- Marc Köhlbrugge ( http://github.com/marckohlbrugge ) fox fixing and formatting the documentation
|
data/Rakefile
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/ruby-hackernews.rb
CHANGED
@@ -4,5 +4,9 @@ require 'mechanize'
|
|
4
4
|
|
5
5
|
require 'require_all'
|
6
6
|
|
7
|
-
require_all File.join(File.dirname(__FILE__), '
|
8
|
-
require_all File.join(File.dirname(__FILE__), '
|
7
|
+
require_all File.join(File.dirname(__FILE__), 'ruby-hackernews', 'domain')
|
8
|
+
require_all File.join(File.dirname(__FILE__), 'ruby-hackernews', 'services')
|
9
|
+
|
10
|
+
Entry.all.first.comments.each do |comment|
|
11
|
+
p comment.text
|
12
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-hackernews
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrea Dallera
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-10 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -61,28 +61,28 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- README.rdoc
|
63
63
|
- Rakefile
|
64
|
-
- lib/
|
65
|
-
- lib/
|
66
|
-
- lib/
|
67
|
-
- lib/
|
68
|
-
- lib/
|
69
|
-
- lib/
|
70
|
-
- lib/
|
71
|
-
- lib/
|
72
|
-
- lib/
|
73
|
-
- lib/
|
74
|
-
- lib/
|
75
|
-
- lib/
|
76
|
-
- lib/
|
77
|
-
- lib/
|
78
|
-
- lib/
|
79
|
-
- lib/
|
80
|
-
- lib/
|
81
|
-
- lib/
|
82
|
-
- lib/
|
83
|
-
- lib/
|
84
|
-
- lib/
|
85
|
-
- lib/
|
64
|
+
- lib/ruby-hackernews/domain/comment/comment.rb
|
65
|
+
- lib/ruby-hackernews/domain/user.rb
|
66
|
+
- lib/ruby-hackernews/domain/entry/link_info.rb
|
67
|
+
- lib/ruby-hackernews/domain/entry/voting_info.rb
|
68
|
+
- lib/ruby-hackernews/domain/entry/time_info.rb
|
69
|
+
- lib/ruby-hackernews/domain/entry/user_info.rb
|
70
|
+
- lib/ruby-hackernews/domain/entry/entry.rb
|
71
|
+
- lib/ruby-hackernews/domain/entry/comments_info.rb
|
72
|
+
- lib/ruby-hackernews/services/parsers/link_info_parser.rb
|
73
|
+
- lib/ruby-hackernews/services/parsers/entry_parser.rb
|
74
|
+
- lib/ruby-hackernews/services/parsers/voting_info_parser.rb
|
75
|
+
- lib/ruby-hackernews/services/parsers/user_info_parser.rb
|
76
|
+
- lib/ruby-hackernews/services/parsers/time_info_parser.rb
|
77
|
+
- lib/ruby-hackernews/services/parsers/entry_page_parser.rb
|
78
|
+
- lib/ruby-hackernews/services/parsers/comments_info_parser.rb
|
79
|
+
- lib/ruby-hackernews/services/voting_service.rb
|
80
|
+
- lib/ruby-hackernews/services/mechanize_context.rb
|
81
|
+
- lib/ruby-hackernews/services/comment_service.rb
|
82
|
+
- lib/ruby-hackernews/services/login_service.rb
|
83
|
+
- lib/ruby-hackernews/services/entry_service.rb
|
84
|
+
- lib/ruby-hackernews/services/not_authenticated_error.rb
|
85
|
+
- lib/ruby-hackernews/services/configuration_service.rb
|
86
86
|
- lib/ruby-hackernews.rb
|
87
87
|
has_rdoc: true
|
88
88
|
homepage: http://github.com/bolthar/ruby-hackernews
|