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

pulibrary / pdc_discovery / 529bb1cf-d0bf-4901-97c6-12679aea8117

17 Aug 2023 01:30PM UTC coverage: 90.265% (-6.3%) from 96.544%
529bb1cf-d0bf-4901-97c6-12679aea8117

Pull #478

circleci

carolyncole
Updates to css to fix tests after bundle update
Also ran rubocop -A && Prettier
Pull Request #478: Switching to selenium to fix CI

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

2142 of 2373 relevant lines covered (90.27%)

93.35 hits per line

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

69.57
/app/lib/dspace_indexer.rb
1
# frozen_string_literal: true
2

3
require 'faraday_middleware'
1✔
4
require 'traject'
1✔
5

6
##
7
# Index DSpace objects to solr
8
class DspaceIndexer
1✔
9
  REST_LIMIT = 100
1✔
10

11
  ##
12
  # @param [String] XML from DSpace rest interface
13
  def initialize(dspace_xml)
1✔
14
    @dspace_xml = dspace_xml
59✔
15
  end
16

17
  ##
18
  # Index XML as received from DSpace
19
  def index
1✔
20
    traject_indexer.process(@dspace_xml)
59✔
21
    traject_indexer.complete
59✔
22
  end
23

24
  def research_data_config_path
1✔
25
    pathname = ::Rails.root.join('lib', 'traject', "dataspace_research_data_config.rb")
59✔
26
    pathname.to_s
59✔
27
  end
28

29
  ##
30
  # Load the traject indexing config for DataSpace research data objects
31
  def traject_indexer
1✔
32
    @traject_indexer ||= Traject::Indexer::NokogiriIndexer.new.tap do |i|
118✔
33
      i.load_config_file(research_data_config_path)
59✔
34
    end
35
  end
36

37
  ##
38
  # TODO: Pass in indexing options from the command line
39
  # Convenience method for kicking off indexing
40
  # @example DspaceIndexer.index(collection_handle: '88435/dsp015m60qr913')
41
  def self.index(_options)
1✔
42
    server = "#{Rails.configuration.pdc_discovery.dataspace_url}/rest"
×
43
    collection_id = '261'
×
44
    url = "#{server}/collections/#{collection_id}/items?limit=#{REST_LIMIT}&offset=0&expand=all"
×
45

46
    resp = Faraday.get(url, {}, { 'Accept': 'application/xml' })
×
47
    i = DspaceIndexer.new(resp.body)
×
48
    i.index
×
49
    i
×
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