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

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

18
    private
×
19

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

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

26
      def data
×
27
        {
×
28
          quid: Rails.application.config_for(:orangelight)[:feedback_form][:queue_id],
×
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
×
38
        return "#{@message}\n\nSent from #{current_url} via LibAnswers API" if current_url
×
39

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

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

47
      def token
×
48
        @token ||= OAuthToken.find_or_create_by({ service: 'libanswers',
×
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