• 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
/app/models/requests/patron.rb
1
# frozen_string_literal: true
UNCOV
2
require 'faraday'
×
3

UNCOV
4
module Requests
×
UNCOV
5
  class Patron
×
UNCOV
6
    attr_reader :user, :patron_hash, :errors
×
7

UNCOV
8
    delegate :guest?, :provider, :cas_provider?, :alma_provider?, to: :user
×
9

UNCOV
10
    def initialize(user:, patron_hash: nil)
×
UNCOV
11
      @user = user
×
UNCOV
12
      @errors = []
×
13
      # load the patron_hash from bibdata or alma unless we are passing it in
UNCOV
14
      @patron_hash = patron_hash || load_patron(user:)
×
UNCOV
15
    end
×
16

UNCOV
17
    def self.authorize(user:)
×
UNCOV
18
      Patron.new(user:)
×
UNCOV
19
    end
×
20

UNCOV
21
    def barcode
×
UNCOV
22
      patron_hash[:barcode]
×
UNCOV
23
    end
×
24

UNCOV
25
    def active_email
×
UNCOV
26
      patron_hash[:active_email] || ldap[:email]
×
UNCOV
27
    end
×
28

UNCOV
29
    def first_name
×
UNCOV
30
      patron_hash[:first_name] || ldap[:givenname]
×
UNCOV
31
    end
×
32

UNCOV
33
    def last_name
×
UNCOV
34
      patron_hash[:last_name] || ldap[:surname]
×
UNCOV
35
    end
×
36

UNCOV
37
    def netid
×
UNCOV
38
      patron_hash[:netid]
×
UNCOV
39
    end
×
40

UNCOV
41
    def patron_id
×
UNCOV
42
      patron_hash[:patron_id]
×
UNCOV
43
    end
×
44

UNCOV
45
    def patron_group
×
UNCOV
46
      patron_hash[:patron_group]
×
UNCOV
47
    end
×
48

UNCOV
49
    def university_id
×
UNCOV
50
      patron_hash[:university_id] || user.uid
×
UNCOV
51
    end
×
52

UNCOV
53
    def eligible_for_library_services?
×
UNCOV
54
      barcode.present?
×
UNCOV
55
    end
×
56

UNCOV
57
    def telephone
×
UNCOV
58
      ldap[:telephone]
×
UNCOV
59
    end
×
60

UNCOV
61
    def status
×
UNCOV
62
      ldap[:status]
×
UNCOV
63
    end
×
64

UNCOV
65
    def pustatus
×
UNCOV
66
      ldap[:pustatus]
×
UNCOV
67
    end
×
68

UNCOV
69
    def department
×
UNCOV
70
      ldap[:department]
×
UNCOV
71
    end
×
72

UNCOV
73
    def title
×
UNCOV
74
      ldap[:title]
×
UNCOV
75
    end
×
76

UNCOV
77
    def address
×
UNCOV
78
      ldap[:address]
×
UNCOV
79
    end
×
80

UNCOV
81
    def ldap
×
UNCOV
82
      patron_hash[:ldap] || {}
×
UNCOV
83
    end
×
84

UNCOV
85
    def blank?
×
UNCOV
86
      patron_hash.empty?
×
UNCOV
87
    end
×
88

UNCOV
89
    def to_h
×
UNCOV
90
      patron_hash
×
UNCOV
91
    end
×
92

UNCOV
93
    private
×
94

UNCOV
95
      def load_patron(user:)
×
UNCOV
96
        patron_hash = current_patron_hash(user.uid)
×
UNCOV
97
        errors << "A problem occurred looking up your library account." if patron_hash.blank?
×
UNCOV
98
        patron_hash || {}
×
UNCOV
99
      end
×
100

UNCOV
101
      def current_patron_hash(uid)
×
UNCOV
102
        if alma_provider?
×
UNCOV
103
          AlmaPatron.new(uid:).patron_hash
×
UNCOV
104
        else
×
UNCOV
105
          FullPatron.new(user:).patron_hash
×
UNCOV
106
        end
×
UNCOV
107
      end
×
UNCOV
108
  end
×
UNCOV
109
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