red_cap 0.14.1 → 0.14.2

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: 36636ca97ecbc285bee3b241613528ac0613a7b659e748371b2f5b1ec77e9f01
4
- data.tar.gz: 1b0ebfb0a5c072da1547eba1895fce194acc6e448fdc3d75c6c2a389793da8a4
3
+ metadata.gz: 75c95f3f3e905fccfe82f20754f92b9053b9b6f492ab9b5b7844474e8ee6575d
4
+ data.tar.gz: c3671800d96ee275e784df61667f136577f1522313b48cd4a4857a7a19ebfcca
5
5
  SHA512:
6
- metadata.gz: faad7dafd7aca38aae641ffab0f4c1f39510d7bd4304276f4da06325e7325de0e0f0ab898ac952b7891d90efc89d77a6a05d4dc102881f22079879214382e97d
7
- data.tar.gz: d909c706b988d376fa10f77d64417466cf3139127f68ede9c29905777248b876edf9841ea8ef3bf814baf2bb7540dd24a0c84914bd09f9aa747f24c57a15372e
6
+ metadata.gz: f0b0e1fe99c81654b909d5d43c88051e7a2b637fff80ff9a36f661584d5995016e10d0c7054051c18cd082bb5abab8f738e46c92b6ac2a93a56e165e6b9b5319
7
+ data.tar.gz: 3df33fcdc76c6a3c0db0ba721ade7863f6de436ec49095b03a47824b1eb66dfb5554b9db968ed97386cda0da55e37c3d0d5b290d51569b41ac99a5a2d902c941
@@ -9,7 +9,7 @@ jobs:
9
9
  strategy:
10
10
  fail-fast: false
11
11
  matrix:
12
- ruby: ['3.2', '3.3', '3.4']
12
+ ruby: ['3.3', '3.4', '4.0']
13
13
 
14
14
  steps:
15
15
  - uses: actions/checkout@v4
@@ -68,7 +68,7 @@ class REDCap
68
68
  def json_api_request options
69
69
  request_options = options.reverse_merge(format: "json")
70
70
  json = base_request(request_options).body
71
- JSON.load(json)
71
+ parse json
72
72
  end
73
73
 
74
74
  def cached_json_api_request options
@@ -77,11 +77,18 @@ class REDCap
77
77
  request_options = options.reverse_merge(format: "json")
78
78
  base_request(request_options).body
79
79
  end
80
- JSON.load(json)
80
+ parse json
81
81
  end
82
82
 
83
83
  private
84
84
 
85
+ require "active_support/core_ext/string/filters"
86
+ def parse json
87
+ JSON.load(json)
88
+ rescue JSON::ParserError
89
+ raise NonJSONResponseError, "REDCap sent a response that isn't JSON: #{json.squish.truncate(200)}"
90
+ end
91
+
85
92
  def base_request options
86
93
  connection = Faraday.new(url: @url)
87
94
  connection.options.open_timeout = 300
@@ -94,5 +101,8 @@ class REDCap
94
101
  end
95
102
 
96
103
  class Error < StandardError; end
104
+
105
+ # a JSON::ParserError, so callers that rescue Error don't mistake a broken REDCap for an API refusal
106
+ class NonJSONResponseError < JSON::ParserError; end
97
107
  end
98
108
  end
@@ -1,3 +1,3 @@
1
1
  class REDCap
2
- VERSION = "0.14.1"
2
+ VERSION = "0.14.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: red_cap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-11-24 00:00:00.000000000 Z
10
+ date: 2026-11-18 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: faraday