• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / pdc_describe / b1776731-62d7-41a7-882d-6a5b4760db75

14 May 2024 12:28PM UTC coverage: 79.223% (-16.7%) from 95.9%
b1776731-62d7-41a7-882d-6a5b4760db75

push

circleci

carolyncole
Adding a submission completion page

fixes #1791

9 of 9 new or added lines in 2 files covered. (100.0%)

567 existing lines in 42 files now uncovered.

2692 of 3398 relevant lines covered (79.22%)

60.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.59
/app/models/pdc_metadata/name_identifier.rb
1
# frozen_string_literal: true
2
# Class for storing a named identifier for the creator in our local representation.  This identifier can be a person or organization.
3
# **Please Note:**
4
# The class name NameIdentifier is being utilized becuase it matches with the DataCite Schema: https://support.datacite.org/docs/datacite-metadata-schema-v44-mandatory-properties#24-nameidentifier
5
# It also matches with the DataCite xml mapping gem that we are utilizing: https://github.com/CDLUC3/datacite-mapping/blob/master/lib/datacite/mapping/name_identifier.rb
6
module PDCMetadata
1✔
7
  # value:      "0000-0001-5000-0007"
8
  # scheme:     "ORCID"
9
  # scheme_uri: "https://orcid.org/""
10
  class NameIdentifier
1✔
11
    attr_accessor :value, :scheme, :scheme_uri
1✔
12
    def initialize(value: nil, scheme: nil, scheme_uri: nil)
1✔
13
      @value = value
113✔
14
      @scheme = scheme
113✔
15
      @scheme_uri = scheme_uri
113✔
16
    end
17

18
    ORCID = "ORCID"
1✔
19
    ROR = "ROR"
1✔
20

21
    def orcid_url
1✔
22
      return nil unless scheme == ORCID
7✔
23
      "#{scheme_uri}/#{value}"
7✔
24
    end
25

26
    def orcid
1✔
27
      return nil unless scheme == ORCID
117✔
28
      value
117✔
29
    end
30

31
    def ror
1✔
32
      ror_url
2✔
33
    end
34

35
    # Allow override of where to look up ROR values.
36
    # This lets us test ROR behavior without making network calls.
37
    # See spec/support/orcid_specs.rb for more info
38
    def ror_url
1✔
39
      return nil unless scheme == ROR
2✔
40

41
      value
2✔
42
    end
43

44
    def ror_id
1✔
UNCOV
45
      return nil unless scheme == ROR
×
UNCOV
46
      value.split("/").last
×
47
    end
48

49
    def self.new_orcid(value)
1✔
50
      NameIdentifier.new(value:, scheme: ORCID, scheme_uri: "https://orcid.org")
109✔
51
    end
52

53
    def self.new_ror(value)
1✔
54
      NameIdentifier.new(value:, scheme: ROR, scheme_uri: "https://ror.org")
4✔
55
    end
56
  end
57
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc