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.
10 11 12 |
# File 'lib/accession/accession/service.rb', line 10 def provider @provider end |
Instance Method Details
#broker ⇒ Object
30 31 32 |
# File 'lib/accession/accession/service.rb', line 30 def broker ega? ? provider.to_s : '' end |
#ega? ⇒ Boolean
22 23 24 |
# File 'lib/accession/accession/service.rb', line 22 def ega? provider == :EGA end |
#ena? ⇒ Boolean
18 19 20 |
# File 'lib/accession/accession/service.rb', line 18 def ena? provider == :ENA end |
#login ⇒ Object
38 39 40 41 |
# File 'lib/accession/accession/service.rb', line 38 def login return configatron.accession.ega!.to_hash if ega? configatron.accession.ena!.to_hash if ena? end |
#url ⇒ Object
34 35 36 |
# File 'lib/accession/accession/service.rb', line 34 def url configatron.accession.url! if valid? end |
#visibility ⇒ Object
26 27 28 |
# File 'lib/accession/accession/service.rb', line 26 def visibility ena? ? 'HOLD' : 'PROTECT' end |