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

pulibrary / bibdata / aa977bbb-cb49-44c2-84c5-66aa8ea1e89a

05 Mar 2026 04:37PM UTC coverage: 68.266% (-22.0%) from 90.235%
aa977bbb-cb49-44c2-84c5-66aa8ea1e89a

Pull #3059

circleci

sandbergja
Remove orangetheses

Closes #2816
Pull Request #3059: Remove orangetheses

7015 of 10276 relevant lines covered (68.27%)

12.91 hits per line

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

9.68
/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]
×
8
    if valid_barcode?(barcode)
×
9
      adapter = AlmaAdapter.new
×
10
      item = adapter.item_by_barcode(barcode)
×
11
      mms_id = item['bib_data']['mms_id']
×
12
      record = adapter.get_bib_record(mms_id, show_suppressed: true)
×
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?
×
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'])
×
20
      records = if record.linked_record_ids.present?
×
21
                  adapter.get_bib_records(record.linked_record_ids)
×
22
                else
23
                  [record]
×
24
                end
25
      records.each do |bib_record|
×
26
        bib_record.enrich_with_item(item)
×
27
        bib_record.delete_conflicting_holding_data!
×
28
        bib_record.enrich_with_holding(holding, recap: true)
×
29
        bib_record.strip_non_numeric!
×
30
      end
31
      if records == []
×
32
        render plain: "Barcode #{barcode} not found.", status: :not_found
×
33
      else
34
        respond_to do |wants|
×
35
          wants.json  do
×
36
            render json: pass_records_through_xml_parser(records)
×
37
          end
38
          wants.xml do
×
39
            xml = records_to_xml_string(records)
×
40
            render xml:
×
41
          end
42
        end
43
      end
44
    else
45
      render plain: "Barcode #{barcode} not valid.", status: :not_found
×
46
    end
47
  rescue StandardError => e
48
    handle_alma_exception(exception: e, message: "Error for barcode: #{barcode}")
×
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