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

pulibrary / bibdata / 373ad6ff-fad2-405a-ab26-3d30fb5ceecf

24 Dec 2024 08:24PM UTC coverage: 91.938% (+0.08%) from 91.859%
373ad6ff-fad2-405a-ab26-3d30fb5ceecf

Pull #2563

circleci

maxkadel
Put attaching xml files in their own batch
Pull Request #2563: I2321 Shift SCSB full index tasks into separate background jobs

152 of 156 new or added lines in 10 files covered. (97.44%)

65 existing lines in 17 files now uncovered.

3478 of 3783 relevant lines covered (91.94%)

366.14 hits per line

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

92.31
/app/models/scsb_full_records_request.rb
1
class ScsbFullRecordsRequest
1✔
2
  attr_accessor :scsb_env, :email
1✔
3

4
  def initialize(scsb_env, email)
1✔
5
    @scsb_env = scsb_env
6✔
6
    @email = email
6✔
7
  end
8

9
  def scsb_host
1✔
10
    case scsb_env
6✔
11
    when 'uat'
12
      'https://uat-recap.htcinc.com:9093'
4✔
13
    when 'production'
14
      'https://scsb.recaplib.org:9093'
2✔
15
    end
16
  end
17

18
  def scsb_conn
1✔
19
    Faraday.new(url: scsb_host) do |faraday|
4✔
20
      faraday.request(:url_encoded)
4✔
21
    end
22
  end
23

24
  # See https://scsb.recaplib.org:9093/swagger-ui.html#/data-dump-rest-controller/exportDataDump for documentation
25
  def scsb_request(institution_code)
1✔
26
    response = scsb_conn.get do |req|
3✔
27
      req.path = '/dataDump/exportDataDump'
3✔
28
      req.params['collectionGroupIds'] = '1,2,5,6'
3✔
29
      req.params['emailToAddress'] = email
3✔
30
      req.params['fetchType'] = 10
3✔
31
      req.params['imsDepositoryCodes'] = repository_codes(institution_code)
3✔
32
      req.params['institutionCodes'] = institution_code
3✔
33
      req.params['outputFormat'] = 0
3✔
34
      req.params['requestingInstitutionCode'] = 'PUL'
3✔
35
      req.params['transmissionType'] = 0
3✔
36
      req.headers['Accept'] = '*/*'
3✔
37
      req.headers['api_key'] = scsb_auth_key
3✔
38
    end
39
    expected_response_body = "Export process has started and we will send an email notification upon completion"
3✔
40
    Rails.logger.error("Received unexpected response: #{response.body}") unless response.body == expected_response_body
3✔
41
    response
3✔
42
  rescue Faraday::ConnectionFailed, Faraday::TimeoutError => connection_failed
43
    Rails.logger.warn("#{self.class}: Connection error for #{scsb_server}")
×
44
    raise connection_failed
×
45
  end
46

47
  def repository_codes(institution_code)
1✔
48
    case institution_code
3✔
49
    when 'PUL', 'CUL'
50
      'RECAP'
2✔
51
    when 'HL'
52
      'RECAP,HD'
1✔
53
    end
54
  end
55

56
  private
1✔
57

58
    def scsb_auth_key
1✔
59
      if !Rails.env.test?
3✔
UNCOV
60
        ENV['SCSB_AUTH_KEY']
×
61
      else
62
        'TESTME'
3✔
63
      end
64
    end
65
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