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.



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

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

Instance Method Details

#providerObject



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

def provider
  :unsuitable
end

#submit(_user, *_accessionables) ⇒ Object



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

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)


31
32
33
34
35
36
# File 'app/models/unsuitable_accession_service.rb', line 31

def submit_dac_for_user(_study, _user)
  raise StandardError,
        # rubocop:todo Layout/LineLength
        'UnsuitableAccessionService should only be used for samples. This is a problem with Sequencescape and should be reported.'
  # rubocop:enable Layout/LineLength
end

#submit_sample_for_user(_sample, _user) ⇒ Object



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

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)


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

def submit_study_for_user(_study, _user)
  raise StandardError,
        # rubocop:todo Layout/LineLength
        'UnsuitableAccessionService should only be used for samples. This is a problem with Sequencescape and should be reported.'
  # rubocop:enable Layout/LineLength
end