Sha256: da8751629d11792c2531d9525662d71676050004ba637100bf035a31a7ddfda5
Contents?: true
Size: 794 Bytes
Versions: 1
Compression:
Stored size: 794 Bytes
Contents
module Harvestdor class Indexer # Client for working with the PURL Fetcher API class PurlFetcher attr_reader :config def initialize(config = {}) @config = config end def druids_from_collection(collection) return to_enum(:druids_from_collection, collection) unless block_given? page = 1 loop do response = client.get("/collections/#{collection}/purls", page: page, per_page: 100) data = JSON.parse(response.body) break if data['purls'].blank? data['purls'].each { |d| yield d['druid'] } page += 1 break if data['pages']['next_page'].nil? end end private def client @client ||= Faraday.new(config) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
harvestdor-indexer-2.5.0 | lib/harvestdor/indexer/purl_fetcher.rb |