antbird 1.1.0 → 1.2.0

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: 2d00e228d8e4628e1e0a0f0fb34e0df4382c552266b1510f44734ef022757569
4
- data.tar.gz: 6d4d6abd75ee27a4756eac51b6039b44f438f378ca4fe23ccd95905ce61eee25
3
+ metadata.gz: 4fa1a5ef17ca8b183c23e877b88386b4b28bdf9da8cfc35faf1285be1adb8a13
4
+ data.tar.gz: b7084f2d7fd314254d20f6f382f6947b456efde369ec444ec7621f68ae567920
5
5
  SHA512:
6
- metadata.gz: 0a0e44ac7de86a2671b3571ba407dd262f01ed976bb70648e397d112ccd28b5c169397a528231105fc9fd7b175f427185beadfd0508cf523b000104313a92059
7
- data.tar.gz: e2aaf781014694479d8710dfefa417a1e29b993600ecf043aab7b44713e66630143e3a4ae1550bc9328184d5b6a4948b47d4daa2f6b19f36681ae8c44e57e6ae
6
+ metadata.gz: e552dc0dfa4fdfa137a157de7f6b110047542c9c1e79ad881e9b7aeeb48a463e9021ce209b9dac868357aeab16bb2d5f58f37e0644f5faf402852c93a9314a5f
7
+ data.tar.gz: dbac1bc2360ab6120349d8a003d75929142fce2a286f65623b3e9dd75e9699d13e7c113c4394035b7b0d33e88cb7ecb1b7eb6d772c98462f36be527199f653bf
@@ -13,6 +13,9 @@ jobs:
13
13
  matrix:
14
14
  # https://github.com/opensearch-project/OpenSearch/releases
15
15
  search_versions:
16
+ - 3.8.0
17
+ - 3.7.0
18
+ - 3.6.0
16
19
  - 3.5.0
17
20
  - 3.4.0
18
21
  - 3.3.2
@@ -36,7 +39,7 @@ jobs:
36
39
  sudo sysctl -w vm.swappiness=1
37
40
  sudo sysctl -w fs.file-max=262144
38
41
  sudo sysctl -w vm.max_map_count=262144
39
- - uses: actions/checkout@v6
42
+ - uses: actions/checkout@v7
40
43
  - uses: ruby/setup-ruby@v1
41
44
  with:
42
45
  ruby-version: "4.0"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- antbird (1.1.0)
4
+ antbird (1.2.0)
5
5
  faraday (>= 2.0.1)
6
6
 
7
7
  GEM
@@ -11,18 +11,18 @@ GEM
11
11
  public_suffix (>= 2.0.2, < 8.0)
12
12
  connection_pool (3.0.2)
13
13
  diff-lcs (1.6.2)
14
- faraday (2.14.2)
14
+ faraday (2.14.3)
15
15
  faraday-net_http (>= 2.0, < 3.5)
16
16
  json
17
17
  logger
18
- faraday-net_http (3.4.2)
18
+ faraday-net_http (3.4.4)
19
19
  net-http (~> 0.5)
20
20
  faraday-net_http_persistent (2.3.1)
21
21
  faraday (~> 2.5)
22
22
  net-http-persistent (>= 4.0.4, < 5)
23
23
  faraday-retry (2.4.0)
24
24
  faraday (~> 2.0)
25
- json (2.19.5)
25
+ json (3.0.1)
26
26
  logger (1.7.0)
27
27
  net-http (0.9.1)
28
28
  uri (>= 0.11.1)
@@ -0,0 +1,20 @@
1
+ require 'json'
2
+
3
+ module Antbird
4
+ class Client
5
+ # Faraday's JSON response middleware hands parser options to the decoder as
6
+ # a positional Hash (`decoder.parse(body, options)`). json 3.0 turned
7
+ # JSON.parse into `parse(source, **options)`, so that call raises
8
+ # ArgumentError and every response fails with Faraday::ParsingError.
9
+ # Decoding through here keeps antbird working on both json 2.x and 3.x.
10
+ module JsonDecoder
11
+ module_function
12
+
13
+ def parse(body, options = {})
14
+ return ::JSON.parse(body) if options.nil? || options.empty?
15
+
16
+ ::JSON.parse(body, **options)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,6 @@
1
1
  require 'faraday'
2
2
  require 'antbird/client/errors'
3
+ require 'antbird/client/json_decoder'
3
4
 
4
5
  module Antbird
5
6
  class Client
@@ -186,7 +187,7 @@ module Antbird
186
187
  @block&.call(conn)
187
188
 
188
189
  conn.request :json
189
- conn.response :json, content_type: /\bjson$/
190
+ conn.response :json, content_type: /\bjson$/, parser_options: { decoder: [JsonDecoder, :parse] }
190
191
 
191
192
  conn.options[:timeout] = read_timeout
192
193
  conn.options[:open_timeout] = open_timeout