Class: Accession::Service
- Inherits:
-
Object
- Object
- Accession::Service
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/accession/accession/service.rb
Overview
Provide all of the configuration relating to the type of accessioning. Used by Accession::Request to send to the correct service.
Constant Summary collapse
- PROVIDERS =
{ 'managed' => :EGA, 'open' => :ENA }.freeze
Instance Attribute Summary collapse
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Instance Method Summary collapse
- #broker ⇒ Object
- #ega? ⇒ Boolean
- #ena? ⇒ Boolean
-
#initialize(study_type = nil) ⇒ Service
constructor
A new instance of Service.
- #login ⇒ Object
- #url ⇒ Object
- #visibility ⇒ Object
Constructor Details
Instance Attribute Details
#provider ⇒ Object (readonly)
Returns the value of attribute provider
9 10 11 |
# File 'lib/accession/accession/service.rb', line 9 def provider @provider end |
Instance Method Details
#broker ⇒ Object
29 30 31 |
# File 'lib/accession/accession/service.rb', line 29 def broker ega? ? provider.to_s : '' end |
#ega? ⇒ Boolean
21 22 23 |
# File 'lib/accession/accession/service.rb', line 21 def ega? provider == :EGA end |
#ena? ⇒ Boolean
17 18 19 |
# File 'lib/accession/accession/service.rb', line 17 def ena? provider == :ENA end |
#login ⇒ Object
37 38 39 40 |
# File 'lib/accession/accession/service.rb', line 37 def login return configatron.accession.ega!.to_hash if ega? return configatron.accession.ena!.to_hash if ena? end |
#url ⇒ Object
33 34 35 |
# File 'lib/accession/accession/service.rb', line 33 def url configatron.accession.url! if valid? end |
#visibility ⇒ Object
25 26 27 |
# File 'lib/accession/accession/service.rb', line 25 def visibility ena? ? 'HOLD' : 'PROTECT' end |