fb_scrape 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/lib/fb_scrape/comment.rb +7 -2
- data/lib/fb_scrape/post.rb +8 -2
- data/lib/fb_scrape/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1a9ddf896ea4be8199af9719cad12ac839bcdea
|
4
|
+
data.tar.gz: 27174503c585c683b16a91afa8a7e85b9261b994
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 511e6752cf92cff996cf2592223696cdd9a165ffb109ab54728bb9c43840de695a242ae60c970f042f0fde09fdd2260e88001f0d7717c0008463b137bbfa8a21
|
7
|
+
data.tar.gz: 9bec19ff984f8641fe08ee04826136be28e69648a7b0d0c9583581e5346ee4b55bebe72f0c93350a23834bc260411aefa4fe306ed2908dc221e832e321cafdde
|
data/lib/fb_scrape/comment.rb
CHANGED
@@ -25,8 +25,8 @@ class FBScrape::Comment
|
|
25
25
|
@page_info && next_cursor
|
26
26
|
end
|
27
27
|
|
28
|
-
def load_all_replies
|
29
|
-
while has_more_replies? do
|
28
|
+
def load_all_replies(limit=nil)
|
29
|
+
while has_more_replies? && is_below_limit?(limit) do
|
30
30
|
load_more_replies
|
31
31
|
end
|
32
32
|
end
|
@@ -44,6 +44,11 @@ class FBScrape::Comment
|
|
44
44
|
|
45
45
|
private
|
46
46
|
|
47
|
+
def is_below_limit?(limit)
|
48
|
+
is_below_limit = limit.nil? || @replies.length < limit
|
49
|
+
end
|
50
|
+
|
51
|
+
|
47
52
|
def next_cursor
|
48
53
|
@page_info["cursors"]["next"]
|
49
54
|
end
|
data/lib/fb_scrape/post.rb
CHANGED
@@ -29,12 +29,14 @@ class FBScrape::Post
|
|
29
29
|
@page_info && next_cursor
|
30
30
|
end
|
31
31
|
|
32
|
-
def load_all_comments
|
33
|
-
while has_more_comments? do
|
32
|
+
def load_all_comments(limit=nil)
|
33
|
+
while has_more_comments? && is_below_limit?(limit) do
|
34
34
|
load_more_comments
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
|
39
|
+
|
38
40
|
def to_json(*args)
|
39
41
|
JSON.pretty_generate({
|
40
42
|
id: @id,
|
@@ -47,6 +49,10 @@ class FBScrape::Post
|
|
47
49
|
|
48
50
|
private
|
49
51
|
|
52
|
+
def is_below_limit?(limit)
|
53
|
+
is_below_limit = limit.nil? || @comments.length < limit
|
54
|
+
end
|
55
|
+
|
50
56
|
def load_from_url url
|
51
57
|
resp = HTTParty.get(url)
|
52
58
|
case resp.code
|
data/lib/fb_scrape/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb_scrape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Kimenye
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|