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

pulibrary / orangelight / 62bad3f1-d46d-40af-822c-403d653da2a8

17 Jun 2025 05:30PM UTC coverage: 0.447% (-94.9%) from 95.337%
62bad3f1-d46d-40af-822c-403d653da2a8

push

circleci

maxkadel
Install chrome & chromedriver for smoke specs

43 of 9610 relevant lines covered (0.45%)

0.01 hits per line

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

0.0
/app/models/requests/submissions/service.rb
1
# frozen_string_literal: true
2
module Requests::Submissions
×
3
  class Service
×
4
    attr_reader :service_type, :success_message, :submission, :errors, :sent
×
5

6
    def initialize(submission, service_type:)
×
7
      @submission = submission
×
8
      @sent = [] # array of hashes of bibid and item_ids for each successfully sent item
×
9
      @errors = [] # array of hashes with bibid and item_id and error message
×
10
      @service_type = service_type
×
11
      @success_message = I18n.t("requests.submit.#{service_type}_success", default: I18n.t('requests.submit.success'))
×
12
    end
×
13

14
    def handle
×
15
      raise NotImplementedError
×
16
    end
×
17

18
    def submitted
×
19
      @sent
×
20
    end
×
21

22
    # This has to be a utility function to prevent ActiveJob from trying to serialize too many objects
23
    # :reek:UtilityFunction
24
    def send_mail
×
25
      return if errors.present?
×
26
      hashed_submission = submission.to_h # Sidekiq will only accept a hash, not a Requests::Submission object
×
27
      Requests::RequestMailer.send("#{service_type}_email", hashed_submission).deliver_later
×
28
      Requests::RequestMailer.send("#{service_type}_confirmation", hashed_submission).deliver_later
×
29
    end
×
30

31
    def error_hash
×
32
      errors = @errors.map { |error| { type: error[:type], error: error[:error], bibid: error[:bibid], barcode: error[:barcode], reply_text: error[:reply_text] } }
×
33
      [[@service_type, errors]].to_h
×
34
    end
×
35
  end
×
36
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