Sha256: e2854192249c1e960b35f769d28dcc660a039a2980c767254584992a659dfb6d
Contents?: true
Size: 899 Bytes
Versions: 2
Compression:
Stored size: 899 Bytes
Contents
require_relative 'doi_utils' require_relative 'author_utils' require_relative 'date_utils' require_relative 'datacite_utils' require_relative 'utils' module Bolognese class Metadata include Bolognese::DoiUtils include Bolognese::AuthorUtils include Bolognese::DateUtils include Bolognese::DataciteUtils include Bolognese::Utils attr_reader :id, :raw, :provider def initialize(id: nil) @id = normalize_id(id) @provider = find_provider(@id) end def normalize_id(id) normalize_doi(id) || normalize_orcid(id) end def find_provider(id) if /\A(?:(http|https):\/\/(dx\.)?doi.org\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(id) get_doi_ra(id).fetch("id", nil) elsif /\A(?:(http|https):\/\/orcid\.org\/)?(\d{4}-\d{4}-\d{4}-\d{3}[0-9X]+)\z/.match(id) "orcid" else "schema_org" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bolognese-0.4.3 | lib/bolognese/metadata.rb |
bolognese-0.4.2 | lib/bolognese/metadata.rb |