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

pulibrary / bibdata / 1dcebae2-3318-4e77-bc53-82276e293354

02 May 2025 04:45PM UTC coverage: 28.256% (-63.9%) from 92.189%
1dcebae2-3318-4e77-bc53-82276e293354

push

circleci

sandbergja
Add basic infrastructure for compiling rust code

* Add a rake compile task to compile
* Run the rake task in CI
* Run the rake task before rspec tests with the rust tag, to provide quick feedback on rust changes in TDD cycles

2 of 7 new or added lines in 2 files covered. (28.57%)

2467 existing lines in 97 files now uncovered.

1089 of 3854 relevant lines covered (28.26%)

0.29 hits per line

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

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