Class: UnsuitableAccessionService

Inherits:
AccessionService show all
Defined in:
app/models/unsuitable_accession_service.rb

Overview

Used for samples/studies which are neither open or managed.

Constant Summary

Constants inherited from AccessionService

AccessionService::AccessionServiceError, AccessionService::CenterName, AccessionService::Hold, AccessionService::NumberNotGenerated, AccessionService::NumberNotRequired, AccessionService::Protect

Instance Method Summary collapse

Methods inherited from AccessionService

#accession_dac_xml, #accession_policy_xml, #accession_sample_xml, #accession_study_xml, #dac_visibility, #policy_visibility, #private?, #sample_visibility, #study_visibility

Constructor Details

#initialize(studies) ⇒ UnsuitableAccessionService

Returns a new instance of UnsuitableAccessionService


5
6
7
# File 'app/models/unsuitable_accession_service.rb', line 5

def initialize(studies)
  @study_ids = studies.map(&:id)
end

Instance Method Details

#providerObject


9
10
11
# File 'app/models/unsuitable_accession_service.rb', line 9

def provider
  :unsuitable
end

#submit(_user, *_accessionables) ⇒ Object


13
14
15
# File 'app/models/unsuitable_accession_service.rb', line 13

def submit(_user, *_accessionables)
  raise AccessionService::NumberNotGenerated, I18n.t(:no_suitable_study, scope: 'accession_service.unsuitable', study_ids: @study_ids.to_sentence)
end

#submit_dac_for_user(_study, _user) ⇒ Object

Raises:

  • (StandardError)

25
26
27
# File 'app/models/unsuitable_accession_service.rb', line 25

def submit_dac_for_user(_study, _user)
  raise StandardError, 'UnsuitableAccessionService should only be used for samples. This is a problem with Sequencescape and should be reported.'
end

#submit_sample_for_user(_sample, _user) ⇒ Object


17
18
19
# File 'app/models/unsuitable_accession_service.rb', line 17

def submit_sample_for_user(_sample, _user)
  raise AccessionService::NumberNotGenerated, I18n.t(:no_suitable_study, scope: 'accession_service.unsuitable', study_ids: @study_ids.to_sentence)
end

#submit_study_for_user(_study, _user) ⇒ Object

Raises:

  • (StandardError)

21
22
23
# File 'app/models/unsuitable_accession_service.rb', line 21

def submit_study_for_user(_study, _user)
  raise StandardError, 'UnsuitableAccessionService should only be used for samples. This is a problem with Sequencescape and should be reported.'
end