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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7574dd18cfcb664982bd58bac580c86a3a0414da03f6e969ea707fa13f44be9b
4
- data.tar.gz: 05317e7cf3994f09d27b2e1cfecc7775d400bb4222a64281da3540e84c2fbcdc
3
+ metadata.gz: c92a66b9d1f752e01a51b3bc21f2f623c245239e893aaecbf034dcff960e43c0
4
+ data.tar.gz: efd9af0c94d48954fd160976d5195f73e65f9742d2891ac807143aff49fababe
5
5
  SHA512:
6
- metadata.gz: 99d5d0b34d293b5c32a088bc0d54fb46dbd860af70b58b30b5e4646aa3c5bc4d30f42e8514b0f7589aa72285a2df250218502840b52afb1fac3fdfcc0217785c
7
- data.tar.gz: d10722a79d7fc28cbb3c91e1224e6ff85b43544f34ba22b2dd8ddc123c85b6435fd80013d8fd38174812f03b6d839d23b17d38a0c25bc56b2ee38cedd0bdbde1
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
- encoded_ts = URI.encode_www_form_component(checkpoint[:last_timestamp])
175
+ last_timestamp = checkpoint[:last_timestamp].to_s
176
+ last_key = checkpoint[:last_key].to_s.gsub("'", "''")
176
177
 
177
- # checkpoint filter: everything strictly after the last (timestamp, key) pair
178
- checkpoint_filter = "(ModificationTimestamp gt #{encoded_ts}) " \
179
- "or (ModificationTimestamp eq #{encoded_ts} and ListingKey gt '#{checkpoint[:last_key]}')"
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" => fields.join(","),
187
- "$filter" => conditions.join(" and "),
187
+ "$select" => fields.join(","),
188
+ "$filter" => conditions.join(" and "),
188
189
  "$orderby" => "ModificationTimestamp,ListingKey",
189
- "$top" => batch_size
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.map { |key, value| "#{key}=#{value}" }.join("&")
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
- URI.encode_www_form(options)
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AmplifySyndication
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
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.2
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: 2025-11-19 00:00:00.000000000 Z
11
+ date: 2026-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient