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

pulibrary / allsearch_api / 5f4d62c0-09fd-47a8-9e19-97c060ec4515

09 May 2025 02:30PM UTC coverage: 99.49%. Remained the same
5f4d62c0-09fd-47a8-9e19-97c060ec4515

Pull #365

circleci

maxkadel
Try smoke tests in CD pipeline
Pull Request #365: Self hosted runner experiment

976 of 981 relevant lines covered (99.49%)

101.15 hits per line

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

100.0
/app/models/catalog_document.rb
1
# frozen_string_literal: true
2

3
# This class is responsible for getting relevant
4
# metadata from the Catalog's JSON
5
# The document is a Hash
6
class CatalogDocument < Document
3✔
7
  include SolrDocument
3✔
8

9
  private
3✔
10

11
  include Holdings
3✔
12

13
  def service
3✔
14
    'catalog'
97✔
15
  end
16

17
  def title
3✔
18
    document[:title_display]
96✔
19
  end
20

21
  def creator
3✔
22
    document[:author_display]&.first
95✔
23
  end
24

25
  def publisher
3✔
26
    document[:pub_created_display]&.first
95✔
27
  end
28

29
  def type
3✔
30
    document[:format]&.first
95✔
31
  end
32

33
  def description
3✔
34
    # tbd - nothing in the current json that seems relevant
35
  end
36

37
  def doc_keys
3✔
38
    [:first_barcode, :second_barcode, :first_call_number, :second_call_number, :first_library, :second_library,
96✔
39
     :first_status, :second_status, :resource_url, :resource_url_label]
40
  end
41

42
  def resource_url
3✔
43
    portfolio['url'] || electronic_access&.keys&.first
98✔
44
  end
45

46
  def resource_url_label
3✔
47
    return unless should_display_resource_url_label?
100✔
48

49
    portfolio['title'] || electronic_access&.values&.first&.first || 'Online content'
14✔
50
  end
51

52
  def should_display_resource_url_label?
3✔
53
    portfolio.present? || electronic_access.present?
100✔
54
  end
55

56
  def portfolio
3✔
57
    @portfolio ||= begin
212✔
58
      portfolio_string = document[:electronic_portfolio_s]&.first
102✔
59
      portfolio_string.present? ? JSON.parse(portfolio_string) : {}
102✔
60
    end
61
  end
62

63
  def electronic_access
3✔
64
    @electronic_access ||= begin
175✔
65
      electronic_access_string = document[:electronic_access_1display]
89✔
66
      electronic_access_string.present? ? JSON.parse(electronic_access_string) : {}
89✔
67
    end
68
  end
69

70
  def do_not_sanitize_these_fields
3✔
71
    super + [:resource_url]
1,740✔
72
  end
73
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