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

pulibrary / orangelight / 00dbc10b-d747-4ad7-b211-7b26d753abbb

14 Aug 2025 01:25PM UTC coverage: 0.483% (-94.9%) from 95.343%
00dbc10b-d747-4ad7-b211-7b26d753abbb

push

circleci

web-flow
Merge pull request #5181 from pulibrary/dependabot/bundler/activestorage-7.2.2.2

Bump activestorage from 7.2.2.1 to 7.2.2.2

47 of 9721 relevant lines covered (0.48%)

0.01 hits per line

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

0.0
/app/services/oauth_service.rb
1
# frozen_string_literal: true
2

3
# This class is responsible for communicating with an
4
# OAuth server to get new access tokens
5
class OAuthService
×
6
  class CouldNotGenerateOAuthToken < StandardError; end
×
7

8
  def initialize(endpoint:, service:)
×
9
    @endpoint = URI(endpoint)
×
10
    @service = service.to_sym
×
11
  end
×
12

13
  def new_token
×
14
    token = JSON.parse(response.body)['access_token']
×
15
    raise CouldNotGenerateOAuthToken unless token
×
16
    token
×
17
  end
×
18

19
  def expiration_time
×
20
    validity_in_seconds = JSON.parse(response.body)['expires_in']
×
21
    validity_in_seconds.seconds.from_now - 1.hour
×
22
  end
×
23

24
    private
×
25

26
      attr_reader :endpoint, :service
×
27

28
      def client_id
×
29
        configuration[:client_id]
×
30
      end
×
31

32
      def client_secret
×
33
        configuration[:client_secret]
×
34
      end
×
35

36
      def response
×
37
        @response ||= Net::HTTP.post_form(endpoint, client_id:, client_secret:, grant_type:)
×
38
      end
×
39

40
      def grant_type
×
41
        'client_credentials'
×
42
      end
×
43

44
      def configuration
×
45
        @configuration ||= Rails.application.config_for(:orangelight)[service]
×
46
      end
×
47
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