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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

89
    def to_h
×
90
      patron_hash
×
91
    end
×
92

93
    private
×
94

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

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