red_cap 0.8.0 → 0.9.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 +5 -1
- data/lib/red_cap/form/fields.rb +1 -1
- data/lib/red_cap/form.rb +1 -1
- data/lib/red_cap/version.rb +2 -2
- data/lib/red_cap.rb +26 -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: d78e642412a6c1130c646f78d9857495c5c47face4834f9f89ee5f323f4f9ed2
|
4
|
+
data.tar.gz: 21eeaefdc5c38b84916ae2257f8ba14fc3e89d327c392dd9b703973ca6c8d351
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfbca51100d14bc29820d402cef3bef6ef45a2c3878e3e9f6b31d45f06b65c53e915db3dd0e2496fd055c3d86fb5abcc84aa9d30128af5e3d0c79140a4739887
|
7
|
+
data.tar.gz: fff7559efdd1645e5cc781d192694f002b0f2f3476777dfcb6bdfe74cc5a541bea1f4acb224738767420f10b645e680f947d7504db2ddfff5e8a4001be1e80e0
|
data/lib/red_cap/client.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "json"
|
2
2
|
require "faraday"
|
3
3
|
|
4
|
-
|
4
|
+
class REDCap
|
5
5
|
class Client
|
6
6
|
def initialize url: REDCap.url, token: REDCap.token, per_page: REDCap.per_page
|
7
7
|
@url = url
|
@@ -24,6 +24,10 @@ module REDCap
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
def find_record study_id
|
28
|
+
json_api_request(content: "record", records: study_id).first
|
29
|
+
end
|
30
|
+
|
27
31
|
def metadata
|
28
32
|
json_api_request(content: "metadata")
|
29
33
|
end
|
data/lib/red_cap/form/fields.rb
CHANGED
data/lib/red_cap/form.rb
CHANGED
data/lib/red_cap/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = "0.
|
1
|
+
class REDCap
|
2
|
+
VERSION = "0.9.0"
|
3
3
|
end
|
data/lib/red_cap.rb
CHANGED
@@ -2,7 +2,7 @@ require "red_cap/version"
|
|
2
2
|
require "red_cap/client"
|
3
3
|
require "red_cap/form"
|
4
4
|
|
5
|
-
|
5
|
+
class REDCap
|
6
6
|
class << self
|
7
7
|
def configure
|
8
8
|
yield self
|
@@ -14,5 +14,30 @@ module REDCap
|
|
14
14
|
@per_page ||= 100
|
15
15
|
end
|
16
16
|
end
|
17
|
+
|
18
|
+
def form
|
19
|
+
@form ||= Form.new(client.metadata)
|
20
|
+
end
|
21
|
+
|
22
|
+
def find study_id
|
23
|
+
client.find_record study_id
|
24
|
+
end
|
25
|
+
|
26
|
+
def all &block
|
27
|
+
client.records &block
|
28
|
+
end
|
29
|
+
|
30
|
+
def where conditions, &block
|
31
|
+
filters = conditions.reduce([]) do |filters, (field, value)|
|
32
|
+
filters << "[#{field}]=#{value}"
|
33
|
+
end
|
34
|
+
client.records(filters.join(" AND "), &block)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def client
|
40
|
+
@client ||= Client.new
|
41
|
+
end
|
17
42
|
end
|
18
43
|
|
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.9.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: 2019-11-
|
11
|
+
date: 2019-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|