• 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/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
×
6
  # rubocop:disable Metrics/ParameterLists
7
  def initialize(message:, patron_name:, patron_email:, title:, context:, quid:)
×
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
×
18
    Net::HTTP.post uri, body, { Authorization: "Bearer #{token}" }
×
19
  end
×
20

21
    private
×
22

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

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

29
      def data
×
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
×
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
×
46
        @uri ||= URI('https://faq.library.princeton.edu/api/1.1/ticket/create')
×
47
      end
×
48

49
      def token
×
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