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

pulibrary / orangelight / 4c391e0e-519a-40cb-8ad3-354445f4ce03

12 Aug 2025 08:47PM UTC coverage: 85.348% (-10.0%) from 95.335%
4c391e0e-519a-40cb-8ad3-354445f4ce03

push

circleci

web-flow
[#5143] Use access restriction note as Aeon ItemInfo1 if available (#5173)

With this commit, if a user visits a record with an access
restrictions note and presses the Reading Room Request
button, they will get to an Aeon form with the 'Restrictions'
field pre-filled with the restriction note.

If the record does not have an access restrictions note,
the field will be pre-filled with 'Reading Room Access Only',
as it has been previously.

Closes #5143

5493 of 6436 relevant lines covered (85.35%)

251.82 hits per line

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

43.48
/app/models/record_feedback_form_submission.rb
1
# frozen_string_literal: true
2
# This class is responsible for conveying a
3
# form submission to the libanswers API,
4
# which will create a ticket for us to answer
5
class RecordFeedbackFormSubmission
1✔
6
  # rubocop:disable Metrics/ParameterLists
7
  def initialize(message:, patron_name:, patron_email:, title:, context:, quid:)
1✔
8
    @message = message
×
9
    @patron_name = patron_name
×
10
    @patron_email = patron_email
×
11
    @title = title
×
12
    @context = context
×
13
    @quid = quid
×
14
  end
15
  # rubocop:enable Metrics/ParameterLists
16

17
  def send_to_libanswers
1✔
18
    Net::HTTP.post uri, body, { Authorization: "Bearer #{token}" }
×
19
  end
20

21
    private
1✔
22

23
      attr_reader :patron_name, :patron_email, :context, :title, :quid
1✔
24

25
      def body
1✔
26
        @body ||= data.to_a.map { |entry| "#{entry[0]}=#{entry[1]}" }.join('&')
×
27
      end
28

29
      def data
1✔
30
        {
31
          quid:,
×
32
          pquestion: title,
33
          pdetails: message,
34
          pname: patron_name,
35
          pemail: patron_email
36
        }.compact
37
      end
38

39
      def message
1✔
40
        return "#{@message}\n\nSent from #{context} via LibAnswers API" if context.present?
×
41

42
        "#{@message}\n\nSent via LibAnswers API"
×
43
      end
44

45
      def uri
1✔
46
        @uri ||= URI('https://faq.library.princeton.edu/api/1.1/ticket/create')
×
47
      end
48

49
      def token
1✔
50
        @token ||= OAuthToken.find_or_create_by({ service: 'libanswers',
×
51
                                                  endpoint: 'https://faq.library.princeton.edu/api/1.1/oauth/token' }).token
52
      end
53
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