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

pulibrary / allsearch_api / e43dfb02-d031-4d11-b014-78d284122bdb

08 May 2025 02:52PM UTC coverage: 99.49%. Remained the same
e43dfb02-d031-4d11-b014-78d284122bdb

Pull #363

circleci

web-flow
Bump rack from 3.1.12 to 3.1.14

Bumps [rack](https://github.com/rack/rack) from 3.1.12 to 3.1.14.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/v3.1.12...v3.1.14)

---
updated-dependencies:
- dependency-name: rack
  dependency-version: 3.1.14
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #363: Bump rack from 3.1.12 to 3.1.14

976 of 981 relevant lines covered (99.49%)

101.15 hits per line

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

100.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
3✔
6
  def initialize(endpoint:, service:)
3✔
7
    @endpoint = URI(endpoint)
26✔
8
    @service = service.to_sym
26✔
9
  end
10

11
  def new_token
3✔
12
    token = JSON.parse(response.body)['access_token']
25✔
13
    unless token
25✔
14
      raise AllsearchError.new(problem: 'UPSTREAM_ERROR',
2✔
15
                               msg: 'Could not generate a valid authentication token with upstream service.')
16
    end
17
    token
23✔
18
  end
19

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

25
  private
3✔
26

27
  attr_reader :endpoint, :service
3✔
28

29
  def client_id
3✔
30
    configuration[:client_id]
26✔
31
  end
32

33
  def client_secret
3✔
34
    configuration[:client_secret]
26✔
35
  end
36

37
  def response
3✔
38
    @response ||= Net::HTTP.post_form(endpoint, client_id:, client_secret:, grant_type:)
48✔
39
  end
40

41
  def grant_type
3✔
42
    'client_credentials'
26✔
43
  end
44

45
  def configuration
3✔
46
    @configuration ||= Rails.application.config_for(:allsearch)[service]
52✔
47
  end
48
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