Class: Autoselect::Otu::Levels::CatalogueOfLife
Overview
Delegates to the TaxonName CatalogueOfLife level and wraps results with
hook metadata indicating they should trigger a TaxonName-creation flow.
Constant Summary
Constants inherited
from Level
Level::DEFAULT_FUSE_MS, Level::EXTERNAL_FUSE_MS, Level::MINIMUM_RESULTS
Instance Method Summary
collapse
#record_info, #record_info_html
Methods inherited from Level
#fuse_ms, #metadata, #minimum_results, #model_key, #record_info, #record_info_html
Instance Method Details
#call(term:, operator: nil, project_id: nil, user_id: nil, dataset_id: nil, **_kwargs) ⇒ Array<OpenStruct>
Returns pseudo-records with _col_extension including hook metadata.
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/autoselect/otu/levels/catalogue_of_life.rb', line 38
def call(term:, operator: nil, project_id: nil, user_id: nil, dataset_id: nil, **_kwargs)
taxon_name_level = ::Autoselect::TaxonName::Levels::CatalogueOfLife.new
col_records = taxon_name_level.call(term:, operator:, project_id:, user_id:, dataset_id:)
col_records.map do |record|
extension = record._col_extension.merge(
hook: { create_url: '/otus/autoselect_col_create', yields: 'otu_id' }
)
OpenStruct.new(
id: nil,
name: record.cached,
taxon_name: nil,
_col_extension: extension
)
end
end
|
#description ⇒ Object
18
19
20
|
# File 'lib/autoselect/otu/levels/catalogue_of_life.rb', line 18
def description
'Search the Catalogue of Life for matching names. Returns external results that can be used to create a new OTU linked to a TaxonName.'
end
|
#external? ⇒ Boolean
22
23
24
|
# File 'lib/autoselect/otu/levels/catalogue_of_life.rb', line 22
def external?
true
end
|
#key ⇒ Object
10
11
12
|
# File 'lib/autoselect/otu/levels/catalogue_of_life.rb', line 10
def key
:catalogue_of_life
end
|
#label ⇒ Object
14
15
16
|
# File 'lib/autoselect/otu/levels/catalogue_of_life.rb', line 14
def label
'Catalogue of Life'
end
|
#record_label(record) ⇒ Object
26
27
28
|
# File 'lib/autoselect/otu/levels/catalogue_of_life.rb', line 26
def record_label(record)
record.name.to_s
end
|
#record_label_html(record) ⇒ Object
30
31
32
|
# File 'lib/autoselect/otu/levels/catalogue_of_life.rb', line 30
def record_label_html(record)
record.name.to_s
end
|