Sha256: 964c0c5906555c447817855aabb381926cdba5b4b9f7fcd1336a026336d8ce22
Contents?: true
Size: 692 Bytes
Versions: 6
Compression:
Stored size: 692 Bytes
Contents
require "openbd_api" require "faraday_middleware/parse_oj" require "parallel" require "logger" logger = Logger.new(STDERR) logger.level = Logger::DEBUG N = 10_000 MAX_PARA = 4 MAX_REQ = 10 # if you want to get all data, use `nil` client = OpenBD::Client.new(response_parser: :oj) coverage = client.coverage.body Parallel.each_with_index(coverage.each_slice(N), in_processes: MAX_PARA) do |list, i| raise Parallel::Break if MAX_REQ && i >= MAX_REQ logger.debug "req: #{i}..." client.bulk_get(list).each do |item| summary = item.summary print "#{summary.isbn}: #{summary.title}\n" ## to reduce outputs, show only first title break end end
Version data entries
6 entries across 6 versions & 1 rubygems