lib/datacite/mapping/related_identifier.rb in datacite-mapping-0.1.6 vs lib/datacite/mapping/related_identifier.rb in datacite-mapping-0.1.7
- old
+ new
@@ -139,43 +139,10 @@
# Globally unique identifier of a related resource.
class RelatedIdentifier
include XML::Mapping
- root_element_name 'relatedIdentifier'
-
- # @!attribute [rw] relation_type
- # @return [RelationType] the relationship of the {Resource} to the related resource. Cannot be nil.
- typesafe_enum_node :relation_type, '@relationType', class: RelationType
-
- # @!attribute [rw] value
- # @return [String] the identifier value. Cannot be nil.
- text_node :value, 'text()'
-
- # @!attribute [rw] identifier_type
- # @return [RelatedIdentifierType] the type of the related identifier. Cannot be nil.
- typesafe_enum_node :identifier_type, '@relatedIdentifierType', class: RelatedIdentifierType
-
- # @!attribute [rw] related_metadata_scheme
- # @return [String, nil] the name of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
- text_node :related_metadata_scheme, '@relatedMetadataScheme', default_value: nil
-
- # @!attribute [rw] scheme_uri
- # @return [URI, nil] the URI of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
- uri_node :scheme_uri, '@schemeURI', default_value: nil
-
- # @!attribute [rw] scheme_type
- # @return [String, nil] the type of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
- text_node :scheme_type, '@schemeType', default_value: nil
-
- maybe_alias :_relation_type=, :relation_type=
- private :_relation_type=
- maybe_alias :_value=, :value=
- private :_value=
- maybe_alias :_identifier_type=, :identifier_type=
- private :_identifier_type=
-
# Initializes a new {RelatedIdentifier}.
# @param relation_type [RelationType] the relationship of the {Resource} to the related resource. Cannot be nil.
# @param value [String] the identifier value. Cannot be nil.
# @param identifier_type [RelatedIdentifierType] the type of the related identifier. Cannot be nil.
# @param related_metadata_scheme [String, nil] the name of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
@@ -190,20 +157,47 @@
self.scheme_type = scheme_type
end
def value=(value)
fail ArgumentError, 'Value cannot be empty or nil' unless value && !value.empty?
- self._value = value
+ @value = value
end
def identifier_type=(value)
fail ArgumentError, 'Identifier type cannot be empty or nil' unless value
- self._identifier_type = value
+ @identifier_type = value
end
def relation_type=(value)
fail ArgumentError, 'Relation type cannot be nil' unless value
- self._relation_type = value
+ @relation_type = value
end
+
+ root_element_name 'relatedIdentifier'
+
+ # @!attribute [rw] relation_type
+ # @return [RelationType] the relationship of the {Resource} to the related resource. Cannot be nil.
+ typesafe_enum_node :relation_type, '@relationType', class: RelationType
+
+ # @!attribute [rw] value
+ # @return [String] the identifier value. Cannot be nil.
+ text_node :value, 'text()'
+
+ # @!attribute [rw] identifier_type
+ # @return [RelatedIdentifierType] the type of the related identifier. Cannot be nil.
+ typesafe_enum_node :identifier_type, '@relatedIdentifierType', class: RelatedIdentifierType
+
+ # @!attribute [rw] related_metadata_scheme
+ # @return [String, nil] the name of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
+ text_node :related_metadata_scheme, '@relatedMetadataScheme', default_value: nil
+
+ # @!attribute [rw] scheme_uri
+ # @return [URI, nil] the URI of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
+ uri_node :scheme_uri, '@schemeURI', default_value: nil
+
+ # @!attribute [rw] scheme_type
+ # @return [String, nil] the type of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
+ text_node :scheme_type, '@schemeType', default_value: nil
+
end
end
end