• 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

95.45
/app/models/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 FeedbackFormSubmission
1✔
6
  def initialize(message:, patron_name:, patron_email:, user_agent:, current_url:)
1✔
7
    @message = message
2✔
8
    @patron_name = patron_name
2✔
9
    @patron_email = patron_email
2✔
10
    @user_agent = user_agent
2✔
11
    @current_url = current_url
2✔
12
  end
13

14
  def send_to_libanswers
1✔
15
    Net::HTTP.post uri, body, { Authorization: "Bearer #{token}" }
2✔
16
  end
17

18
    private
1✔
19

20
      attr_reader :patron_name, :patron_email, :user_agent, :current_url
1✔
21

22
      def body
1✔
23
        @body ||= data.to_a.map { |entry| "#{entry[0]}=#{entry[1]}" }.join('&')
14✔
24
      end
25

26
      def data
1✔
27
        {
28
          quid: Rails.application.config_for(:orangelight)[:feedback_form][:queue_id],
2✔
29
          pquestion: 'Princeton University Library Catalog Feedback Form',
30
          pdetails: message,
31
          pname: patron_name,
32
          pemail: patron_email,
33
          ua: user_agent
34
        }.compact
35
      end
36

37
      def message
1✔
38
        return "#{@message}\n\nSent from #{current_url} via LibAnswers API" if current_url
2✔
39

40
        "#{@message}\n\nSent via LibAnswers API"
×
41
      end
42

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

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