Class: Accessionable::Base::Tag::FieldCountryOfOrigin
- Inherits:
-
FieldSerializer
- Object
- FieldSerializer
- Accessionable::Base::Tag::FieldCountryOfOrigin
- Defined in:
- app/models/accessionable/base.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 FieldSerializer
Accessionable::Base::Tag::FieldSerializer::MISING_THIRD_PARTY_DATA, Accessionable::Base::Tag::FieldSerializer::MISSING_CONTROL_SAMPLE, Accessionable::Base::Tag::FieldSerializer::MISSING_DATA_AGGREEMENT_PRE2023, Accessionable::Base::Tag::FieldSerializer::MISSING_ENDANGERED_SPECIES, Accessionable::Base::Tag::FieldSerializer::MISSING_HUMAN_IDENTIFIABLE, Accessionable::Base::Tag::FieldSerializer::MISSING_LAB_STOCK, Accessionable::Base::Tag::FieldSerializer::MISSING_SAMPLE_GROUP, Accessionable::Base::Tag::FieldSerializer::MISSING_SYNTHETIC_CONSTRUCT, Accessionable::Base::Tag::FieldSerializer::NOT_APPLICABLE_CONTROL_SAMPLE, Accessionable::Base::Tag::FieldSerializer::NOT_APPLICABLE_SAMPLE_GROUP, Accessionable::Base::Tag::FieldSerializer::NOT_COLLECTED, Accessionable::Base::Tag::FieldSerializer::NOT_PROVIDED, Accessionable::Base::Tag::FieldSerializer::OTHER_DEFAULT_SETTINGS, Accessionable::Base::Tag::FieldSerializer::RESTRICTED_ACCESS
Instance Method Summary collapse
Methods inherited from FieldSerializer
Instance Method Details
#applies_to?(name) ⇒ Boolean
138 139 140 |
# File 'app/models/accessionable/base.rb', line 138 def applies_to?(name) name == :country_of_origin end |
#value_for(value) ⇒ Object
132 133 134 135 136 |
# File 'app/models/accessionable/base.rb', line 132 def value_for(value) return value if OTHER_DEFAULT_SETTINGS.include?(value) return incorrect_format_value unless Insdc::Country.find_by(name: value) value end |