class REDCap
Constants
- VERSION
Attributes
per_page[RW]
token[RW]
url[RW]
Public Class Methods
configure() { |self| ... }
click to toggle source
# File lib/red_cap.rb, line 7 def configure yield self end
Public Instance Methods
all(&block)
click to toggle source
# File lib/red_cap.rb, line 26 def all &block client.records &block end
delete(study_id)
click to toggle source
# File lib/red_cap.rb, line 42 def delete study_id client.delete_records [study_id] end
find(study_id)
click to toggle source
# File lib/red_cap.rb, line 22 def find study_id client.find_record study_id end
form()
click to toggle source
# File lib/red_cap.rb, line 18 def form @form ||= Form.new(client.metadata) end
update(study_id, attributes)
click to toggle source
# File lib/red_cap.rb, line 37 def update study_id, attributes record = attributes.merge(study_id: study_id).stringify_keys client.save_records [record] end
where(conditions, &block)
click to toggle source
# File lib/red_cap.rb, line 30 def where conditions, &block filters = conditions.reduce([]) do |filters, (field, value)| filters << "[#{field}]=#{value}" end client.records(filters.join(" AND "), &block) end
Private Instance Methods
client()
click to toggle source
# File lib/red_cap.rb, line 48 def client @client ||= Client.new end