cloud-queues 1.0.2 → 1.0.3
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/lib/cloud-queues/client.rb +8 -5
- data/lib/cloud-queues/messages.rb +7 -2
- data/lib/cloud-queues/version.rb +1 -1
- metadata +2 -2
data/lib/cloud-queues/client.rb
CHANGED
@@ -131,13 +131,14 @@ module CloudQueues
|
|
131
131
|
limit = 10
|
132
132
|
end
|
133
133
|
|
134
|
-
response = request(options)
|
134
|
+
first_response = response = request(options)
|
135
135
|
|
136
|
-
if collection_key and
|
136
|
+
if collection_key and first_response.status != 204
|
137
137
|
# the next href link will have the query represented in it
|
138
138
|
options.delete :query
|
139
139
|
|
140
|
-
collection =
|
140
|
+
collection = first_response.body[collection_key]
|
141
|
+
last_links = first_response.body["links"]
|
141
142
|
|
142
143
|
while response.body[collection_key].count >= limit and collection.count < absolute_limit
|
143
144
|
next_link = response.body["links"].select{|l| l["rel"] == "next" }[0]["href"]
|
@@ -147,12 +148,14 @@ module CloudQueues
|
|
147
148
|
|
148
149
|
break if response.status == 204
|
149
150
|
collection += response.body[collection_key]
|
151
|
+
last_links = response.body["links"]
|
150
152
|
end
|
151
153
|
|
152
|
-
|
154
|
+
first_response.body[collection_key] = collection
|
155
|
+
first_response.body["links"] = last_links
|
153
156
|
end
|
154
157
|
|
155
|
-
return
|
158
|
+
return first_response
|
156
159
|
end
|
157
160
|
|
158
161
|
private
|
@@ -23,11 +23,16 @@ module CloudQueues
|
|
23
23
|
|
24
24
|
def next(options = {})
|
25
25
|
if @marker
|
26
|
-
@queue.messages options.merge(marker: @marker)
|
26
|
+
more = @queue.messages options.merge(marker: @marker)
|
27
|
+
if more.class == Array and more.count == 0
|
28
|
+
@messages = more
|
29
|
+
return self
|
30
|
+
end
|
31
|
+
return more
|
27
32
|
else
|
28
33
|
# We don't have a next marker because this set of messages was
|
29
34
|
# never intended to be part of a larger set.
|
30
|
-
nil
|
35
|
+
return nil
|
31
36
|
end
|
32
37
|
end
|
33
38
|
|
data/lib/cloud-queues/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud-queues
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
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-11-
|
12
|
+
date: 2013-11-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|