Class: Autoselect::TaxonName::Levels::CatalogueOfLife
- Includes:
- Levels::ColRecordInfo, Levels::ColRecordLabel
- Defined in:
- lib/autoselect/taxon_name/levels/catalogue_of_life.rb
Overview
lib/autoselect/taxon_name/levels/catalogue_of_life.rb
Constant Summary
Constants included from Levels::ColSourceMark
Levels::ColSourceMark::COL_ICON, Levels::ColSourceMark::TW_ICON
Constants inherited from Level
Level::DEFAULT_FUSE_MS, Level::EXTERNAL_FUSE_MS, Level::MINIMUM_RESULTS
Instance Method Summary collapse
-
#call(term:, operator: nil, project_id: nil, user_id: nil, dataset_id: nil, **_kwargs) ⇒ Array<OpenStruct>
Pseudo-records compatible with TaxonName autoselect format_results, marked with their code when they span more than one (ColCodeBadge).
- #description ⇒ Object
- #external? ⇒ Boolean
- #key ⇒ Object
- #label ⇒ Object
Methods included from Levels::ColRecordLabel
#col_author_year, #record_label, #record_label_html
Methods included from Levels::ColRecordInfo
#record_info, #record_info_html
Methods included from Levels::ColSourceMark
#col_existing_record?, #col_source_icon, #col_source_tag
Methods inherited from Level
#fuse_ms, #is_default, #metadata, #minimum_results, #model_key, #options_level, #record_info, #record_info_html, #record_label, #record_label_html
Instance Method Details
#call(term:, operator: nil, project_id: nil, user_id: nil, dataset_id: nil, **_kwargs) ⇒ Array<OpenStruct>
Returns pseudo-records compatible with TaxonName autoselect format_results, marked with their code when they span more than one (ColCodeBadge).
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/autoselect/taxon_name/levels/catalogue_of_life.rb', line 30 def call( term:, operator: nil, project_id: nil, user_id: nil, dataset_id: nil, **_kwargs ) raw = ::Vendor::Colrapi.search(term, dataset_id:) results = raw['result'] || [] return [] if results.empty? records = results.filter_map do |col_result| ::Autoselect::TaxonName::ColMatch .new(col_result, project_id:, dataset_id:) .call end ::Autoselect::Levels::ColCodeBadge.mark(records) end |
#description ⇒ Object
14 15 16 17 |
# File 'lib/autoselect/taxon_name/levels/catalogue_of_life.rb', line 14 def description 'Search the Catalogue of Life for matching names. Returns external ' \ 'results with alignment data for confirmation.' end |
#external? ⇒ Boolean
19 20 21 |
# File 'lib/autoselect/taxon_name/levels/catalogue_of_life.rb', line 19 def external? true end |
#key ⇒ Object
6 7 8 |
# File 'lib/autoselect/taxon_name/levels/catalogue_of_life.rb', line 6 def key :catalogue_of_life end |
#label ⇒ Object
10 11 12 |
# File 'lib/autoselect/taxon_name/levels/catalogue_of_life.rb', line 10 def label 'Catalogue of Life' end |