module QldlibraryReport
Constants
- FOOTER
- TAG
Public Instance Methods
Source
# File lib/qldlibrary_report.rb, line 34 def browse_url(query) params = { vid: QldlibraryConfig::VID, tab: QldlibraryConfig::TAB, search_scope: QldlibraryConfig::SCOPE, query: "any,contains,#{query}", lang: QldlibraryConfig::LANG } "https://onesearch.slq.qld.gov.au/discovery/search?#{URI.encode_www_form(params)}" end
Source
# File lib/qldlibrary_report.rb, line 77 def build_fetch_error(query) SearchReport.fetch_error_card( tag: TAG, query: query, fallback_title: "catalogue search", error_lines: [ "Catalogue search unavailable right now.", "Try: #{browse_url(query)}" ], footer_parts: FOOTER ) end
Source
# File lib/qldlibrary_report.rb, line 45 def build_report(query:, total:, items:) if items.empty? return SearchReport.empty_report( tag: TAG, query: query, total: 0, empty_lines: [ "No catalogue matches in One Search.", "Browse: #{browse_url(query)}" ], footer_parts: FOOTER ) end SearchReport.results_report( tag: TAG, query: query, total: total, body_lines: items.each_with_index.map { |item, index| format_item_line(index + 1, item) }, footer_parts: FOOTER ) end
Source
# File lib/qldlibrary_report.rb, line 68 def build_usage SearchReport.usage_card( tag: TAG, title: "catalogue search", usage_message: QldlibrarySearch.usage_message, footer_parts: FOOTER ) end
Source
# File lib/qldlibrary_report.rb, line 24 def format_item_line(index, item) meta = [item[:date], item[:type]].map(&:to_s).reject(&:empty?) SearchReport.list_item_line( index: index, title: QldlibrarySearch.truncate_text(item[:title], QldlibraryConfig::MAX_TITLE_LENGTH), detail_parts: [item[:creator].to_s.strip, meta.join(" ยท ")].reject(&:empty?), url: item[:url] ) end
Source
# File lib/qldlibrary_report.rb, line 20 def heading_title(query, total) SearchReport.heading(query: query, total: total) end