Class: StudyEngine::StudyID::Sync

Inherits:
Object
  • Object
show all
Defined in:
app/models/study_engine/study_id/sync.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.callObject



8
9
10
# File 'app/models/study_engine/study_id/sync.rb', line 8

def self.call
  new.call
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
# File 'app/models/study_engine/study_id/sync.rb', line 12

def call
  raise "Cannot sync with REDCap without setting StudyEngine.redcap_token" if StudyEngine.redcap_token.blank?
  CSV.parse(response, headers: true) do |row|
    process row unless row.empty?
  end
  StudyID::Bank.where(["updated_at < ?", 30.minutes.ago]).delete_all
end