• 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/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
UNCOV
5
class RecordFeedbackFormSubmission
×
6
  # rubocop:disable Metrics/ParameterLists
UNCOV
7
  def initialize(message:, patron_name:, patron_email:, title:, context:, quid:)
×
UNCOV
8
    @message = message
×
UNCOV
9
    @patron_name = patron_name
×
UNCOV
10
    @patron_email = patron_email
×
UNCOV
11
    @title = title
×
UNCOV
12
    @context = context
×
UNCOV
13
    @quid = quid
×
UNCOV
14
  end
×
15
  # rubocop:enable Metrics/ParameterLists
16

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

UNCOV
21
    private
×
22

UNCOV
23
      attr_reader :patron_name, :patron_email, :context, :title, :quid
×
24

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

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

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

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

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

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