red_cap 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/red_cap/client.rb +12 -6
- data/lib/red_cap/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49aa29a5b4552436f251e90d2866a45fc052021d7210c0198516f64edbfcff37
|
4
|
+
data.tar.gz: 6dc7aeb9484414094e1ee9e042ebf3c25727ae38f11c0a8914afab17ecb84d0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a87e812af13a9dfa6ca6dc78b54f772c1eeb2ca00f5fcc6b9bb9ad77e5c79fcb2efcb2ce6dc2d0ae201bfae65f8dc87de5d53cc7ab77a31a0fcf3f4c504e189
|
7
|
+
data.tar.gz: f4f57ab0539ddcb9b3a494c090886d6fb52cc6eb1dc6c75dd5f191ee882ed33e6dae310575033c42a6616ca4835ebd40981d7a853b9e6285e3d7fd5978d916fd
|
data/lib/red_cap/client.rb
CHANGED
@@ -8,8 +8,14 @@ module REDCap
|
|
8
8
|
@token = token
|
9
9
|
end
|
10
10
|
|
11
|
-
def records
|
12
|
-
|
11
|
+
def records filter=nil
|
12
|
+
study_ids =
|
13
|
+
json_api_request(content: "record", fields: "study_id", filterLogic: filter)
|
14
|
+
.map { |hash| hash["study_id"] }
|
15
|
+
|
16
|
+
study_ids.in_groups_of(100, false).flat_map do |study_ids|
|
17
|
+
json_api_request(content: "record", records: study_ids.join(","))
|
18
|
+
end
|
13
19
|
end
|
14
20
|
|
15
21
|
def metadata
|
@@ -23,7 +29,7 @@ module REDCap
|
|
23
29
|
record: record_id,
|
24
30
|
field: file_id,
|
25
31
|
})
|
26
|
-
_, type, filename = *response.headers["content-type"].match(/\A(.+); name=\"(.+)\"/)
|
32
|
+
_, type, filename = *response.headers["content-type"].match(/\A(.+); name=\"(.+)\"\z/)
|
27
33
|
File.new(response.body, type, filename)
|
28
34
|
end
|
29
35
|
|
@@ -40,9 +46,9 @@ module REDCap
|
|
40
46
|
|
41
47
|
def base_request options
|
42
48
|
connection = Faraday.new(url: @url)
|
43
|
-
|
44
|
-
|
45
|
-
|
49
|
+
connection.options.open_timeout = 300
|
50
|
+
connection.options.timeout = 300
|
51
|
+
response = connection.post nil, options.reverse_merge(token: @token)
|
46
52
|
if error_message = response.body[/<error>(.+?)<\/error>/, 1]
|
47
53
|
raise Error.new(error_message)
|
48
54
|
end
|
data/lib/red_cap/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: red_cap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
rubygems_version: 3.0.
|
126
|
+
rubygems_version: 3.0.4
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: Library for connecting to REDCap and parsing forms and data
|