• 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/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
UNCOV
5
class FeedbackFormSubmission
×
UNCOV
6
  def initialize(message:, patron_name:, patron_email:, user_agent:, current_url:)
×
UNCOV
7
    @message = message
×
UNCOV
8
    @patron_name = patron_name
×
UNCOV
9
    @patron_email = patron_email
×
UNCOV
10
    @user_agent = user_agent
×
UNCOV
11
    @current_url = current_url
×
UNCOV
12
  end
×
13

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

UNCOV
18
    private
×
19

UNCOV
20
      attr_reader :patron_name, :patron_email, :user_agent, :current_url
×
21

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

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

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

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

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

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