amplify_syndication 0.3.2 → 0.3.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.
- checksums.yaml +4 -4
- data/lib/amplify_syndication/api.rb +13 -12
- data/lib/amplify_syndication/client.rb +6 -4
- data/lib/amplify_syndication/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c92a66b9d1f752e01a51b3bc21f2f623c245239e893aaecbf034dcff960e43c0
|
|
4
|
+
data.tar.gz: efd9af0c94d48954fd160976d5195f73e65f9742d2891ac807143aff49fababe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a4174eeb7a537ee9f751e19335fce2cb2dbfe18084576c86673065d2ff938070d9092555febe3c6624f0b4c584f13fa34c91443a2a1d72b753057ccd78b1784
|
|
7
|
+
data.tar.gz: 34fc64abfa245212dfe9851d9835e30e17894d806f2a7b0d7f9c46450f9cb08be91d2a738210dc63f7b57d8bc06f127984271ee895f884cb73ca9573118fcc7e
|
|
@@ -170,23 +170,24 @@ module AmplifySyndication
|
|
|
170
170
|
batch_size: 100,
|
|
171
171
|
fields: ["ModificationTimestamp", "ListingKey"],
|
|
172
172
|
filter: nil,
|
|
173
|
-
checkpoint: { last_timestamp: "1970-01-01T00:00:00Z", last_key: 0 }
|
|
173
|
+
checkpoint: { last_timestamp: "1970-01-01T00:00:00Z", last_key: "0" }
|
|
174
174
|
)
|
|
175
|
-
|
|
175
|
+
last_timestamp = checkpoint[:last_timestamp].to_s
|
|
176
|
+
last_key = checkpoint[:last_key].to_s.gsub("'", "''")
|
|
176
177
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
checkpoint_filter =
|
|
179
|
+
"(ModificationTimestamp gt #{last_timestamp}) " \
|
|
180
|
+
"or (ModificationTimestamp eq #{last_timestamp} and ListingKey gt '#{last_key}')"
|
|
180
181
|
|
|
181
182
|
conditions = []
|
|
182
|
-
conditions << "(#{filter})" if filter
|
|
183
|
+
conditions << "(#{filter})" if filter && !filter.empty?
|
|
183
184
|
conditions << "(#{checkpoint_filter})"
|
|
184
185
|
|
|
185
186
|
query_options = {
|
|
186
|
-
"$select"
|
|
187
|
-
"$filter"
|
|
187
|
+
"$select" => fields.join(","),
|
|
188
|
+
"$filter" => conditions.join(" and "),
|
|
188
189
|
"$orderby" => "ModificationTimestamp,ListingKey",
|
|
189
|
-
"$top"
|
|
190
|
+
"$top" => batch_size
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
response = fetch_with_options(resource, query_options)
|
|
@@ -202,7 +203,7 @@ module AmplifySyndication
|
|
|
202
203
|
fields: ["ModificationTimestamp", "ListingKey"],
|
|
203
204
|
filter: nil,
|
|
204
205
|
sleep_seconds: 10,
|
|
205
|
-
checkpoint: { last_timestamp: "1970-01-01T00:00:00Z", last_key: 0 }
|
|
206
|
+
checkpoint: { last_timestamp: "1970-01-01T00:00:00Z", last_key: "0" }
|
|
206
207
|
)
|
|
207
208
|
loop do
|
|
208
209
|
batch = fetch_initial_download_batch(
|
|
@@ -238,7 +239,7 @@ module AmplifySyndication
|
|
|
238
239
|
fields: ["ModificationTimestamp", "ListingKey"],
|
|
239
240
|
filter: nil,
|
|
240
241
|
sleep_seconds: 10,
|
|
241
|
-
checkpoint: { last_timestamp: "1970-01-01T00:00:00Z", last_key: 0 }
|
|
242
|
+
checkpoint: { last_timestamp: "1970-01-01T00:00:00Z", last_key: "0" }
|
|
242
243
|
)
|
|
243
244
|
results = []
|
|
244
245
|
|
|
@@ -268,7 +269,7 @@ module AmplifySyndication
|
|
|
268
269
|
batch_size: 100,
|
|
269
270
|
fields: ["ModificationTimestamp", "ListingKey"],
|
|
270
271
|
filter: nil,
|
|
271
|
-
checkpoint: { last_timestamp: "1970-01-01T00:00:00Z", last_key: 0 },
|
|
272
|
+
checkpoint: { last_timestamp: "1970-01-01T00:00:00Z", last_key: "0" },
|
|
272
273
|
sleep_seconds: 10
|
|
273
274
|
)
|
|
274
275
|
if block_given?
|
|
@@ -16,23 +16,25 @@ module AmplifySyndication
|
|
|
16
16
|
"Authorization" => "Bearer #{@access_token}",
|
|
17
17
|
"Accept" => "application/json"
|
|
18
18
|
}
|
|
19
|
+
|
|
19
20
|
response = @http_client.get(url, params, headers)
|
|
20
21
|
parse_response(response)
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
def get_with_options(endpoint, options = {})
|
|
24
|
-
query_string = options
|
|
25
|
+
query_string = build_query_string(options)
|
|
25
26
|
get("#{endpoint}?#{query_string}")
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
private
|
|
29
30
|
|
|
30
|
-
# Converts a hash of query options into a URL-encoded query string
|
|
31
31
|
def build_query_string(options)
|
|
32
|
-
|
|
32
|
+
options.map do |key, value|
|
|
33
|
+
escaped_value = URI::DEFAULT_PARSER.escape(value.to_s)
|
|
34
|
+
"#{key}=#{escaped_value}"
|
|
35
|
+
end.join("&")
|
|
33
36
|
end
|
|
34
37
|
|
|
35
|
-
# Parses JSON response, raises an error for non-200 responses
|
|
36
38
|
def parse_response(response)
|
|
37
39
|
if response.status == 200
|
|
38
40
|
JSON.parse(response.body)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: amplify_syndication
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stephen Higgins
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-04-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httpclient
|