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

pulibrary / tigerdata-app / 60f5068a-f9b4-46e9-98a4-717f91830714

03 Nov 2025 06:36PM UTC coverage: 91.4%. Remained the same
60f5068a-f9b4-46e9-98a4-717f91830714

Pull #2137

circleci

JaymeeH
update system specs
Pull Request #2137: I2105 request header

2827 of 3093 relevant lines covered (91.4%)

485.89 hits per line

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

100.0
/app/services/pul_datacite.rb
1
# frozen_string_literal: true
2
class PULDatacite
5✔
3
  class << self
5✔
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?
5✔
8
      (Rails.env.development? || Rails.env.test?) && Rails.configuration.datacite.user.blank?
237✔
9
    end
10
  end
11

12
  attr_reader :datacite_connection
5✔
13

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

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