Sha256: 36bf87088a39d12f11e4ef3cb22f9fb7dd37e81ce6bffd14ccc7cd4fe15b4d9a

Contents?: true

Size: 738 Bytes

Versions: 1

Compression:

Stored size: 738 Bytes

Contents

require "skala/adapter/search"
require_relative "../primo_adapter"

class Skala::PrimoAdapter::GetRecords < Skala::Adapter::GetRecords
  def call(record_ids, options = {})
    search_request = Skala::Adapter::Search::Request.new(
      queries: [
        {
          type: "ids",
          query: [record_ids].flatten(1)
        }
      ]
    )

    search_result = adapter.search(search_request, on_campus: true) # because you know the id -> you searched before
    self.class::Result.new({records: search_result.hits}).tap do |_get_records_result|
      _get_records_result.source = search_result.source
      _get_records_result.each do |_element|
        _element.found = true
        _element.version = 1
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skala-1.1.0 lib/skala/primo_adapter/get_records.rb