Class: Accessionable::Base::Tag::FieldCollectionDate
- Inherits:
-
FieldSerializer
- Object
- FieldSerializer
- Accessionable::Base::Tag::FieldCollectionDate
- Defined in:
- app/models/accessionable/base.rb
Overview
Value serialization for collection date in accessioning XML generation It will return a valid collection date 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 NB: this regexp is defined in www.ebi.ac.uk/ena/browser/api/xml/ERC000011
Constant Summary collapse
- REGEXP =
rubocop:disable Layout/LineLength
%r{(^[12][0-9]{3}(-(0[1-9]|1[0-2])(-(0[1-9]|[12][0-9]|3[01])(T[0-9]{2}:[0-9]{2}(:[0-9]{2})?Z?([+-][0-9]{1,2})?)?)?)?(/[0-9]{4}(-[0-9]{2}(-[0-9]{2}(T[0-9]{2}:[0-9]{2}(:[0-9]{2})?Z?([+-][0-9]{1,2})?)?)?)?)?$)}
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
- #applies_to?(name) ⇒ Boolean
-
#value_for(value) ⇒ Object
rubocop:enable Layout/LineLength.
Methods inherited from FieldSerializer
Instance Method Details
#applies_to?(name) ⇒ Boolean
160 161 162 |
# File 'app/models/accessionable/base.rb', line 160 def applies_to?(name) name == :date_of_sample_collection end |
#value_for(value) ⇒ Object
rubocop:enable Layout/LineLength
154 155 156 157 158 |
# File 'app/models/accessionable/base.rb', line 154 def value_for(value) return value if OTHER_DEFAULT_SETTINGS.include?(value) return incorrect_format_value unless REGEXP.match?(value) value end |