Skip to content
Snippets Groups Projects
Commit 11f0a5d2 authored by Bruno Nocera Zanette's avatar Bruno Nocera Zanette
Browse files

Fix bug: DSpace REST URL is not in a config file

parent 14e3094e
No related branches found
No related tags found
No related merge requests found
......@@ -6,47 +6,10 @@ class DspaceService
@dspace_client = dspace_client
end
def self.create_dspace_client(url = 'https://demo.dspace.org/rest', auth_token=nil)
def self.create_dspace_client(url = Rails.application.secrets.dspace_rest_url, auth_token=nil)
@@clients[url] ||= DspaceClient.new(url, auth_token)
end
# def get_all_communities
# community_repository = @dspace_client.repository.community_repository
# all_communities = community_repository.get_all_communities("subCommunities")
#
# setores = []
# all_communities.each do |community|
# unless community.sub_communities.empty?
# setores << build_setor(community)
# end
# end
# setores
# end
#
# def get_community_by_id(id)
# community_repository = @dspace_client.repository.community_repository
#
# community = community_repository.get_community_by_id(id, "subCommunities")
# build_setor(community, community.sub_communities)
# end
#
# def get_subcommunity_by_id(id)
# community_repository = @dspace_client.repository.community_repository
# collection_repository = @dspace_client.repository.collection_repository
#
# community = community_repository.get_community_by_id(id,"parentCommunity")
# disciplinas = build_disciplinas(collection_repository.get_collections_of(community))
# build_departamento(community, disciplinas)
# end
#
# def get_collection_by_id(id)
# collection_repository = @dspace_client.repository.collection_repository
#
# collection = collection_repository.get_collection_by_id(id, "parentCommunityList")
# items = collection_repository.get_collection_items(collection)
# build_disciplina(collection, items)
# end
def get_object_by_id(id)
item_repository = @dspace_client.repository.item_repository
......@@ -120,48 +83,6 @@ class DspaceService
private
# def build_community(community, subcommunities=[])
# Setor.new({
# id: community.id,
# name: community.name,
# introductory_text: community.introductory_text,
# departamentos: subcommunities
# })
# end
#
# def build_subcommunities(community, collections=[])
# Departamento.new({
# id: community.id,
# name: community.name,
# introductory_text: community.introductory_text,
# setor: community.parent_community,
# disciplinas: collections
# })
# end
#
# def build_collection(collection, items=[])
# Disciplina.new({
# id: collection.id,
# name: collection.name,
# introductory_text: collection.introductory_text,
# details_url: collection.short_description,
# departamento: collection.parent_community_list[0],
# setor: collection.parent_community_list[1],
# # TODO: real professor
# professor: Professor.new({id: 1, name: "Prof Joao"}),
# items: items
# })
# end
#
# def build_collections(collections)
# disciplinas = []
#
# collections.each do |c|
# disciplinas << build_disciplina(c)
# end
# disciplinas
# end
def build_object(item, metadata={})
item.new({
id: item.id,
......@@ -184,7 +105,7 @@ class DspaceService
id: bitstream.id,
name: bitstream.name,
description: bitstream.description,
retrieve_link: Rails.application.secrets.dspace_url + bitstream.retrieve_link,
retrieve_link: Rails.application.secrets.dspace_rest_url + bitstream.retrieve_link,
size_bytes: bitstream.size_bytes
})
end
......
development:
dspace_rest_url: https://portalmecdev.c3sl.ufpr.br:8443/rest
test:
dspace_rest_url: https://portalmecdev.c3sl.ufpr.br:8443/rest
production:
dspace_rest_url: https://portalmecdev.c3sl.ufpr.br:8443/rest
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