NeonRAW 0.1.3 → 0.1.4
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/CHANGELOG.md +16 -0
- data/lib/NeonRAW/clients/base/utilities.rb +20 -0
- data/lib/NeonRAW/objects/submission.rb +1 -21
- data/lib/NeonRAW/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d520bb19cf2df3e92d64c328fb23e7131ae2062
|
4
|
+
data.tar.gz: 7929a149e5b1f874ddaf6efaee7d13360228f23b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d643134962de3682723c601b1efe3c6a58b49d772e0265c2ce4061e687117c465a1ff110aa7d0e398b665d3cfd6bf32c1362212036ae1489af9b85c185bbad5
|
7
|
+
data.tar.gz: 752cd17acb19a108d11b8089552ca6be8e7ef203f16203513eea9867258980245fc559c05087c288a4fbcfe589a1b6b1551e08d6d617f0ba0b47a4347ddec935
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## 0.1.4
|
2
|
+
|
3
|
+
* Renamed flatten_comments to flatten_tree and moved it to the client utilities rather than being a submission method.
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
|
7
|
+
* submission.comments no longer raises ServiceUnavailable if the permalink has an accented character in it.
|
8
|
+
|
9
|
+
## 0.1.3
|
10
|
+
|
11
|
+
* handle_ratelimit now checks if X-Ratelimit-Remaining is zero when deciding whether or not to sleep.
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
|
15
|
+
* MoreComments.expand now returns [] if there are no children.
|
16
|
+
|
1
17
|
## 0.1.2
|
2
18
|
|
3
19
|
### Added
|
@@ -34,6 +34,26 @@ module NeonRAW
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
# Flattens comment trees into a single array.
|
38
|
+
# @!method flatten_tree(comments)
|
39
|
+
# @param comments [Array] A list of comments to be checked for replies
|
40
|
+
# to
|
41
|
+
# flatten.
|
42
|
+
# @return [Array] Returns a list of the flattened comments.
|
43
|
+
def flatten_tree(comments)
|
44
|
+
flattened = []
|
45
|
+
stack = comments.dup
|
46
|
+
until stack.empty?
|
47
|
+
comment = stack.shift
|
48
|
+
if comment.is_a?(Objects::Comment)
|
49
|
+
replies = comment.replies
|
50
|
+
stack = replies + stack unless replies.nil?
|
51
|
+
end
|
52
|
+
flattened << comment
|
53
|
+
end
|
54
|
+
flattened
|
55
|
+
end
|
56
|
+
|
37
57
|
# Fetches a list of wiki pages from Reddit.
|
38
58
|
# @!method wikipages
|
39
59
|
# @return [Array<String>] Returns a list of wiki pages.
|
@@ -120,7 +120,7 @@ module NeonRAW
|
|
120
120
|
# @return [Array] Returns an array full of Comments and MoreComments
|
121
121
|
# objects.
|
122
122
|
def comments
|
123
|
-
data = @client.request_data(
|
123
|
+
data = @client.request_data("/comments/#{id}/.json", :get)
|
124
124
|
data_arr = []
|
125
125
|
data[1][:data][:children].each do |comment|
|
126
126
|
if comment[:kind] == 't1'
|
@@ -132,26 +132,6 @@ module NeonRAW
|
|
132
132
|
data_arr
|
133
133
|
end
|
134
134
|
|
135
|
-
# Flattens comment trees into a single array.
|
136
|
-
# @!method flatten_comments(comments)
|
137
|
-
# @param comments [Array] A list of comments to be checked for replies to
|
138
|
-
# flatten.
|
139
|
-
# @return [Array] Returns a list of the flattened comments.
|
140
|
-
def flatten_comments(comments)
|
141
|
-
flattened = []
|
142
|
-
stack = comments.dup
|
143
|
-
|
144
|
-
until stack.empty?
|
145
|
-
comment = stack.shift
|
146
|
-
if comment.is_a?(Comment)
|
147
|
-
replies = comment.replies
|
148
|
-
stack = replies + stack unless replies.nil?
|
149
|
-
end
|
150
|
-
flattened << comment
|
151
|
-
end
|
152
|
-
flattened
|
153
|
-
end
|
154
|
-
|
155
135
|
# Set submission visibility.
|
156
136
|
# @!method hide
|
157
137
|
# @!method unhide
|
data/lib/NeonRAW/version.rb
CHANGED