• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / orangelight / 2944ef25-40a3-4aa4-b558-b6cda61adc66

23 Jan 2025 07:54PM UTC coverage: 95.661% (-0.2%) from 95.82%
2944ef25-40a3-4aa4-b558-b6cda61adc66

Pull #4721

circleci

sandbergja
Queue request emails with data in a hash

Then, once it has been queued, turn the hash back into a
Requests::Submission object.

This helps with #4609, since sidekiq only allows us to queue
emails with data in a very specific list of data types.
Pull Request #4721: Queue requests emails with data in a hash

27 of 29 new or added lines in 6 files covered. (93.1%)

10 existing lines in 2 files now uncovered.

5997 of 6269 relevant lines covered (95.66%)

1518.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

35.71
/app/serializers/submission_serializer.rb
1
# frozen_string_literal: true
2

3
# This class serializes and deserializes the Submission
4
# object so it can be used in ActiveJob queues
5
class SubmissionSerializer < ActiveJob::Serializers::ObjectSerializer
3✔
6
  def serialize(submission)
3✔
UNCOV
7
    patron = submission.patron
×
UNCOV
8
    user = patron.user
×
UNCOV
9
    super(
×
10
      'patron' => {
11
        'user' => {
12
          'uid' => user.uid,
13
          'username' => user.username,
14
          'guest' => user.guest,
15
          'provider' => user.provider
16
        },
17
        'patron_hash' => patron.patron_hash
18
      },
19
      'items' => submission.items,
20
      'bib' => submission.bib,
21
      'services' => [],
22
      'success_messages' => []
23
    )
24
  end
25

26
  # This method is required to implement the ActiveJob::Serializer::ObjectSerializer
27
  # :reek:UtilityFunction
28
  def deserialize(hash)
3✔
UNCOV
29
    user_hash = hash.dig('patron', 'user')
×
UNCOV
30
    user = User.from_hash(user_hash)
×
31
    params = {
UNCOV
32
      requestable: hash['items'],
×
33
      bib: hash['bib']
34
    }
UNCOV
35
    patron = Requests::Patron.new(user:, patron_hash: hash.dig('patron', 'patron_hash'))
×
UNCOV
36
    Requests::Submission.new(params, patron)
×
37
  end
38

39
  private
3✔
40

41
    def klass
3✔
UNCOV
42
      Requests::Submission
×
43
    end
44
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