NeonRAW 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57bbc4462d8e2d494af36526fbcfd430e8ccd5b4
4
- data.tar.gz: a70ed95c2ca96db7cd8b8a2c141f6b4fc284f2c0
3
+ metadata.gz: 4d520bb19cf2df3e92d64c328fb23e7131ae2062
4
+ data.tar.gz: 7929a149e5b1f874ddaf6efaee7d13360228f23b
5
5
  SHA512:
6
- metadata.gz: 65bce4dbb9e567e665b3837989879fd95d0343b9d611f3a705ff31b6346082c81b4f0808cf7f99ff27cf549b4fd7de72ba541422a244d808c267cbcf3535dec3
7
- data.tar.gz: 19d5415f76c8ebe181aef5beb7a327e1737066ea084c444866f4d35ff39718978fe3fc9bb64d963198dec43472615c08e3db343eb128a054f00773b279e5eb96
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(permalink + '.json', :get)
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
@@ -1,3 +1,3 @@
1
1
  module NeonRAW
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: NeonRAW
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - SirNeon