Skip to content
Snippets Groups Projects
Commit 8dc5f3b2 authored by André Starosta's avatar André Starosta
Browse files

Add checker script

parent 58e2dba1
No related branches found
No related tags found
No related merge requests found
# To use local gem:
$LOAD_PATH.unshift('/home/starosta/c3sl/dspace-scripts/dspace-rest-client/lib')
require 'dspace'
# ============================================================================ #
# Create Dspace Client
client = Dspace::Client.new(dspace_api: 'https://seppirdev.c3sl.ufpr.br:8443/rest')
# , logger: Logger.new(STDOUT)
if !client.is_running?
raise 'Can\'t connect to DSpace API.'
end
# Login on Dspace
client.login 'admin@seppirdev.com', 'adminadmin'
# ============================================================================ #
# GET ALL COMMUNITIES
client.communities.all.each do |community|
client.communities.collections(:id => community.id).each do |collection|
itemCount = 0
client.collections.items(:id => collection.id, limit: 10, offset: 0, expand: "metadata").each do |item|
itemCount = itemCount + 1
bitstreamCount = 0
client.items.bitstreams(:id => item.id).each do |bitstream|
bitstreamCount = bitstreamCount + 1
end
if (bitstreamCount == 0)
puts "O item #{item.name} não possui bitstreams"
end
end
if(itemCount == 0)
puts "A colecao #{collection.name} não possui items"
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment