Class: Accession::TagCountryOfOrigin

Inherits:
Tag
  • Object
show all
Defined in:
lib/accession/accession/tag.rb

Overview

Value serialization for country of origin in accessioning XML generation It will return a valid country of origin or ‘not collected’ if nothing provided or invalid It also allow other config settings for the XML service like the list defined inside OTHER_DEFAULT_SETTINGS

Constant Summary

Constants inherited from Tag

Accession::Tag::DEFAULT_ATTRIBUTES

Constants included from Accession::Tag::HelperTagValue

Accession::Tag::HelperTagValue::MISING_THIRD_PARTY_DATA, Accession::Tag::HelperTagValue::MISSING_CONTROL_SAMPLE, Accession::Tag::HelperTagValue::MISSING_DATA_AGGREEMENT_PRE2023, Accession::Tag::HelperTagValue::MISSING_ENDANGERED_SPECIES, Accession::Tag::HelperTagValue::MISSING_HUMAN_IDENTIFIABLE, Accession::Tag::HelperTagValue::MISSING_LAB_STOCK, Accession::Tag::HelperTagValue::MISSING_SAMPLE_GROUP, Accession::Tag::HelperTagValue::MISSING_SYNTHETIC_CONSTRUCT, Accession::Tag::HelperTagValue::NOT_APPLICABLE_CONTROL_SAMPLE, Accession::Tag::HelperTagValue::NOT_APPLICABLE_SAMPLE_GROUP, Accession::Tag::HelperTagValue::NOT_COLLECTED, Accession::Tag::HelperTagValue::NOT_PROVIDED, Accession::Tag::HelperTagValue::OTHER_DEFAULT_SETTINGS, Accession::Tag::HelperTagValue::RESTRICTED_ACCESS

Instance Attribute Summary

Attributes inherited from Tag

#class_name, #ebi_name, #groups, #name, #services, #value

Instance Method Summary collapse

Methods inherited from Tag

#add_value, #array_express?, #array_express_label, #attributes, #initialize, #label, #required_for?, #sample_attributes?, #sample_name?

Methods included from Accession::Tag::HelperTagValue

#incorrect_format_value

Methods included from Equality

#<=>, #to_a

Constructor Details

This class inherits a constructor from Accession::Tag

Instance Method Details

#value_for(record, key) ⇒ Object



109
110
111
112
113
114
# File 'lib/accession/accession/tag.rb', line 109

def value_for(record, key)
  val = record.send(key)
  return val if OTHER_DEFAULT_SETTINGS.include?(val)
  return incorrect_format_value unless Insdc::Country.find_by(name: val)
  val
end