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

pulibrary / orangelight / 0e37073d-109c-440c-949f-49d2aa86311b

18 Aug 2025 09:05PM UTC coverage: 0.482% (-94.9%) from 95.343%
0e37073d-109c-440c-949f-49d2aa86311b

push

circleci

web-flow
Replace per_page_options_for_select with custom component to avoid deprecation issue (#5186)

* Start creating new component to address deprecaton warning

* Replace per_page_options_for_select with custom component to avoid deprecation issue

Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>

---------

Co-authored-by: Ryan Jensen <rj1044@princeton.edu>
Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>

0 of 33 new or added lines in 1 file covered. (0.0%)

9374 existing lines in 213 files now uncovered.

47 of 9753 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
/lib/orangelight/illiad_patron_client.rb
1
# frozen_string_literal: true
2

UNCOV
3
require 'faraday'
×
UNCOV
4
require 'faraday-cookie_jar'
×
5

UNCOV
6
module Orangelight
×
UNCOV
7
  class IlliadPatronClient
×
UNCOV
8
    def initialize(patron)
×
UNCOV
9
      @barcode = patron['barcode']
×
UNCOV
10
      @last_name = patron['last_name']
×
UNCOV
11
      @patron_id = patron['patron_id']
×
UNCOV
12
      @netid = patron['netid']
×
UNCOV
13
      @illiad_api_key = Requests.config["illiad_api_key"]
×
UNCOV
14
      @illiad_api_base = Requests.config["illiad_api_base"]
×
UNCOV
15
    end
×
16

UNCOV
17
    def outstanding_ill_requests
×
18
      # Use "ProcessType eq Borrowing" for interlibrary loan and digital requests
UNCOV
19
      begin
×
UNCOV
20
        response = conn.get do |req|
×
21
          # If we wanted to divide the results RequestType%20eq%20'Loan' is Inter Library Loan and RequestType%20eq%20'Article' is digitization
UNCOV
22
          req.url "/ILLiadWebPlatform/Transaction/UserRequests/#{@netid}?$filter=ProcessType%20eq%20'Borrowing'%20and%20" \
×
UNCOV
23
                  "TransactionStatus%20ne%20'Request%20Finished'%20and%20not%20startswith%28TransactionStatus,'Cancelled'%29"
×
UNCOV
24
          req.headers['Accept'] = 'application/json'
×
UNCOV
25
          req.headers['ApiKey'] = @illiad_api_key
×
UNCOV
26
        end
×
UNCOV
27
      rescue Faraday::ConnectionFailed
×
UNCOV
28
        Rails.logger.info("Unable to Connect to #{@illiad_api_base}")
×
UNCOV
29
        return []
×
UNCOV
30
      end
×
UNCOV
31
      parse_response(response)
×
UNCOV
32
    end
×
33

UNCOV
34
    def cancel_ill_requests(transactions)
×
UNCOV
35
      begin
×
UNCOV
36
        response = []
×
UNCOV
37
        transactions.each do |transaction|
×
UNCOV
38
          response << cancel_ill_request(transaction)
×
UNCOV
39
        end
×
UNCOV
40
      rescue Faraday::ConnectionFailed
×
41
        Rails.logger.info("Unable to Connect to #{@illiad_api_base}")
×
42
        return false
×
UNCOV
43
      end
×
UNCOV
44
      response
×
UNCOV
45
    end
×
46

UNCOV
47
    def conn
×
UNCOV
48
      Faraday.new(url: @illiad_api_base.to_s) do |builder|
×
UNCOV
49
        builder.use :cookie_jar
×
UNCOV
50
        builder.adapter Faraday.default_adapter
×
UNCOV
51
        builder.response :logger
×
UNCOV
52
      end
×
UNCOV
53
    end
×
54

UNCOV
55
    private
×
56

UNCOV
57
      def parse_response(response)
×
UNCOV
58
        return [] unless response.success?
×
UNCOV
59
        json_data = JSON.parse(response.body)
×
60
        # allow dispplay of either Loan or Article fields
UNCOV
61
        json_data.each do |item|
×
UNCOV
62
          item["PhotoJournalTitle"] ||= item["LoanTitle"]
×
UNCOV
63
          item["PhotoArticleAuthor"] ||= item["LoanAuthor"]
×
UNCOV
64
        end
×
UNCOV
65
        json_data
×
UNCOV
66
      end
×
67

UNCOV
68
      def cancel_ill_request(transaction)
×
UNCOV
69
        conn.put do |req|
×
UNCOV
70
          req.url "ILLiadWebPlatform/transaction/#{transaction}/route"
×
UNCOV
71
          req.headers['ApiKey'] = @illiad_api_key
×
UNCOV
72
          req.headers['Content-Type'] = 'application/json'
×
UNCOV
73
          req.body = { Status: 'Cancelled by Customer' }.to_json
×
UNCOV
74
        end
×
UNCOV
75
      end
×
UNCOV
76
  end
×
UNCOV
77
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