Class: REDCap::Client
- Inherits:
-
Object
- Object
- REDCap::Client
- Defined in:
- lib/red_cap/client.rb
Defined Under Namespace
Classes: File
Instance Method Summary collapse
- #file(record_id, file_id) ⇒ Object
-
#initialize(url: REDCap.url, token: REDCap.token) ⇒ Client
constructor
A new instance of Client.
- #metadata ⇒ Object
- #records ⇒ Object
Constructor Details
Instance Method Details
#file(record_id, file_id) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/red_cap/client.rb', line 19 def file record_id, file_id response = base_request({ content: "file", action: "export", record: record_id, field: file_id, }) _, type, filename = *response.headers["content-type"].match(/\A(.+); name=\"(.+)\"\z/) File.new(response.body, type, filename) end |
#metadata ⇒ Object
15 16 17 |
# File 'lib/red_cap/client.rb', line 15 def json_api_request(content: "metadata") end |
#records ⇒ Object
11 12 13 |
# File 'lib/red_cap/client.rb', line 11 def records json_api_request(content: "record") end |