post_haste 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +5 -1
- data/lib/post_haste/comment.rb +12 -2
- data/lib/post_haste/version.rb +1 -1
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -36,7 +36,11 @@ Post Haste currently can accept a URL of a Washington Post article or blog post,
|
|
36
36
|
|
37
37
|
@article.comments.first.author
|
38
38
|
|
39
|
-
=> "
|
39
|
+
=> "iseasygoing"
|
40
|
+
|
41
|
+
@article.comments.first.permalink(@article)
|
42
|
+
|
43
|
+
=> "http://www.washingtonpost.com/blogs/the-fix/post/republicans-on-the-2012-gop-field-blah/2012/03/15/gIQAT7CSFS_comment.html?commentID=washingtonpost.com/ECHO/item/1332046095-915-174"
|
40
44
|
|
41
45
|
|
42
46
|
## In the Wild
|
data/lib/post_haste/comment.rb
CHANGED
@@ -6,7 +6,7 @@ module PostHaste
|
|
6
6
|
class Comment
|
7
7
|
# Represents a comment on a Washington Post story
|
8
8
|
|
9
|
-
attr_reader :id, :article_url, :author, :content, :status, :published
|
9
|
+
attr_reader :id, :article_url, :author, :content, :status, :published , :permalink
|
10
10
|
|
11
11
|
def initialize(params={})
|
12
12
|
params.each_pair do |k,v|
|
@@ -17,11 +17,21 @@ module PostHaste
|
|
17
17
|
def self.create_comments_from_objects(article_url, comments)
|
18
18
|
results = []
|
19
19
|
comments.each do |comment|
|
20
|
-
c = Comment.new({:id => comment['object']['id'], :article_url => article_url, :author => comment['actor']['title'], :content => comment['object']['content'], :status => comment['object']['status'], :published => DateTime.parse(comment['object']['published'])})
|
20
|
+
c = Comment.new({:id => comment['object']['id'].gsub('http://',''), :article_url => article_url, :author => comment['actor']['title'], :content => comment['object']['content'], :status => comment['object']['status'], :published => DateTime.parse(comment['object']['published'])})
|
21
21
|
results << c
|
22
22
|
end
|
23
23
|
results
|
24
24
|
end
|
25
25
|
|
26
|
+
def permalink(article)
|
27
|
+
if article.type == 'BlogStory'
|
28
|
+
article_url.gsub('_blog','_comment')+'?commentID='+id
|
29
|
+
elsif article.type == 'article'
|
30
|
+
article_url.gsub('_story','_comment')+'?commentID='+id
|
31
|
+
else
|
32
|
+
article_url+'?commentID='+id
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
26
36
|
end
|
27
37
|
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.9.
|
4
|
+
version: 0.9.2
|
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-
|
12
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
segments:
|
127
127
|
- 0
|
128
|
-
hash:
|
128
|
+
hash: 3728910405888285188
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
none: false
|
131
131
|
requirements:
|