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
16
# 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)

27
28
29
# File 'app/models/unsuitable_accession_service.rb', line 27

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


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

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)

23
24
25
# File 'app/models/unsuitable_accession_service.rb', line 23

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