post_haste 0.7 → 0.8
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/Gemfile.lock +1 -1
- data/README.md +7 -2
- data/lib/post_haste/article.rb +5 -5
- data/lib/post_haste/version.rb +1 -1
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# PostHaste
|
2
2
|
|
3
|
-
A Ruby library that wraps the JSON endpoints provided for Washington Post articles and blog posts. Potentially suitable for building custom feeds of Washington Post content, in the event that you don't want to actually visit washingtonpost.com. It handles articles and blog posts from the Post's CMS (along with the most recent 15 comments
|
3
|
+
A Ruby library that wraps the JSON endpoints provided for Washington Post articles and blog posts. Potentially suitable for building custom feeds of Washington Post content, in the event that you don't want to actually visit washingtonpost.com. It handles articles and blog posts from the Post's CMS (along with the most recent 15 comments), as well as The Post's WordPress-powered blogs, which have slightly different output (but also includes comments).
|
4
4
|
|
5
5
|
Tested under Ruby 1.9.2 & 1.9.3.
|
6
6
|
|
@@ -24,7 +24,7 @@ Post Haste currently can accept a URL of a Washington Post article or blog post,
|
|
24
24
|
|
25
25
|
url = "http://www.washingtonpost.com/blogs/the-fix/post/republicans-on-the-2012-gop-field-blah/2012/03/15/gIQAT7CSFS_blog.html"
|
26
26
|
|
27
|
-
@article = Article.create_from_url(url, 25) # 25
|
27
|
+
@article = Article.create_from_url(url, 25) # 25 represents number of comments to grab, default is 15.
|
28
28
|
|
29
29
|
@article.title
|
30
30
|
|
@@ -37,6 +37,11 @@ Post Haste currently can accept a URL of a Washington Post article or blog post,
|
|
37
37
|
@article.comments.first.author
|
38
38
|
|
39
39
|
=> "Horatio_Swaggbottom"
|
40
|
+
|
41
|
+
|
42
|
+
## In the Wild
|
43
|
+
|
44
|
+
See an example application at http://postcomments.herokuapp.com/
|
40
45
|
|
41
46
|
## Contributing
|
42
47
|
|
data/lib/post_haste/article.rb
CHANGED
@@ -60,7 +60,7 @@ module PostHaste
|
|
60
60
|
if source == 'cms'
|
61
61
|
create(result, comment_limit)
|
62
62
|
elsif source == 'wordpress'
|
63
|
-
create_from_wordpress(result)
|
63
|
+
create_from_wordpress(result, comment_limit)
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -90,12 +90,12 @@ module PostHaste
|
|
90
90
|
:updated_datetime => parse_datetime(params['contentConfig']['dateConfig']['dateUpdated']),
|
91
91
|
:section => params['metaConfig']['section'],
|
92
92
|
:tags => params['metaConfig']['tags'],
|
93
|
-
:comments => parse_latest_comments(params['contentConfig']['permaLinkURL'], latest_comments_url(params['contentConfig']['permaLinkURL'], limit=
|
93
|
+
:comments => parse_latest_comments(params['contentConfig']['permaLinkURL'], latest_comments_url(params['contentConfig']['permaLinkURL'], limit=limit))
|
94
94
|
|
95
95
|
end
|
96
96
|
|
97
97
|
# creates an Article object from a WordPress JSON response
|
98
|
-
def self.create_from_wordpress(params={})
|
98
|
+
def self.create_from_wordpress(params={}, limit=15)
|
99
99
|
self.new :type => params['post']['type'],
|
100
100
|
:uuid => params['post']['id'],
|
101
101
|
:title => params['post']['title'],
|
@@ -118,8 +118,8 @@ module PostHaste
|
|
118
118
|
:display_datetime => parse_datetime(params['post']['modified']),
|
119
119
|
:updated_datetime => parse_datetime(params['post']['modified']),
|
120
120
|
:section => nil,
|
121
|
-
:tags => params['post']['tags']
|
122
|
-
|
121
|
+
:tags => params['post']['tags'],
|
122
|
+
:comments => parse_latest_comments(params['post']['url'], latest_comments_url(params['post']['url'], limit))
|
123
123
|
end
|
124
124
|
|
125
125
|
end
|
data/lib/post_haste/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: post_haste
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.8'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
segments:
|
111
111
|
- 0
|
112
|
-
hash: -
|
112
|
+
hash: -832960030199381478
|
113
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
114
|
none: false
|
115
115
|
requirements:
|