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

pulibrary / tigerdata-app / 3c95d035-2719-460b-89ff-213dee6c3e40

10 Nov 2025 08:57PM UTC coverage: 88.974% (-2.4%) from 91.371%
3c95d035-2719-460b-89ff-213dee6c3e40

push

circleci

web-flow
Enforce the title requirement to save a draft request (#2172)

ref #2129

2784 of 3129 relevant lines covered (88.97%)

508.97 hits per line

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

73.33
/app/services/pul_datacite.rb
1
# frozen_string_literal: true
2
class PULDatacite
4✔
3
  class << self
4✔
4
    # Determines whether or not a test DOI should be referenced
5
    # (this avoids requests to the DOI API endpoint for non-production deployments)
6
    # @return [Boolean]
7
    def publish_test_doi?
4✔
8
      (Rails.env.development? || Rails.env.test?) && Rails.configuration.datacite.user.blank?
272✔
9
    end
10
  end
11

12
  attr_reader :datacite_connection
4✔
13

14
  def initialize
4✔
15
    @datacite_connection = Datacite::Client.new(username: Rails.configuration.datacite.user,
273✔
16
                                                password: Rails.configuration.datacite.password,
17
                                                host: Rails.configuration.datacite.host)
18
  end
19

20
  def draft_doi
4✔
21
    if PULDatacite.publish_test_doi?
273✔
22
      Rails.logger.info "Using hard-coded test DOI during development."
272✔
23
      "10.34770/tbd"
272✔
24
    else
25
      result = datacite_connection.autogenerate_doi(prefix: Rails.configuration.datacite.prefix)
×
26
      if result.success?
×
27
        result.success.doi
×
28
      else
29
        raise("Error generating DOI. #{result.failure.status} / #{result.failure.reason_phrase}")
×
30
      end
31
    end
32
  end
33
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