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

pulibrary / bibdata / 6a2de155-72e2-4567-98c7-8e31f9dbdc78

29 Jan 2026 03:35PM UTC coverage: 90.235% (+0.03%) from 90.208%
6a2de155-72e2-4567-98c7-8e31f9dbdc78

Pull #3023

circleci

sandbergja
Use the default json gem instead of multijson and oj

The performance difference is within the margin of error,
so let's use the default gem rather than two additional
dependencies.
Pull Request #3023: Use the default json gem instead of multijson and oj

4 of 7 new or added lines in 4 files covered. (57.14%)

9185 of 10179 relevant lines covered (90.23%)

349.4 hits per line

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

87.1
/app/controllers/barcode_controller.rb
1
class BarcodeController < ApplicationController
1✔
2
  include FormattingConcern
1✔
3

4
  # Client: This endpoint is used by the ReCAP inventory management system, LAS,
5
  #   to pull data from our ILS when items are accessioned
6
  def scsb
1✔
7
    barcode = params[:barcode]
9✔
8
    if valid_barcode?(barcode)
9✔
9
      adapter = AlmaAdapter.new
8✔
10
      item = adapter.item_by_barcode(barcode)
8✔
11
      mms_id = item['bib_data']['mms_id']
6✔
12
      record = adapter.get_bib_record(mms_id, show_suppressed: true)
6✔
13

14
      # If the bib record is not found, the returned record will be nil and the controller should return with a 404 status
15
      if record.nil?
6✔
16
        render plain: "Record #{mms_id} not found", status: :not_found
×
17
        return
×
18
      end
19
      holding = adapter.holding_by_id(mms_id:, holding_id: item.holding_data['holding_id'])
6✔
20
      records = if record.linked_record_ids.present?
5✔
21
                  adapter.get_bib_records(record.linked_record_ids)
1✔
22
                else
23
                  [record]
4✔
24
                end
25
      records.each do |bib_record|
5✔
26
        bib_record.enrich_with_item(item)
6✔
27
        bib_record.delete_conflicting_holding_data!
6✔
28
        bib_record.enrich_with_holding(holding, recap: true)
6✔
29
        bib_record.strip_non_numeric!
6✔
30
      end
31
      if records == []
5✔
32
        render plain: "Barcode #{barcode} not found.", status: :not_found
×
33
      else
34
        respond_to do |wants|
5✔
35
          wants.json  do
5✔
NEW
36
            render json: pass_records_through_xml_parser(records)
×
37
          end
38
          wants.xml do
5✔
39
            xml = records_to_xml_string(records)
5✔
40
            render xml:
5✔
41
          end
42
        end
43
      end
44
    else
45
      render plain: "Barcode #{barcode} not valid.", status: :not_found
1✔
46
    end
47
  rescue StandardError => e
48
    handle_alma_exception(exception: e, message: "Error for barcode: #{barcode}")
3✔
49
  end
50
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

© 2026 Coveralls, Inc