Skip to content
Snippets Groups Projects
Commit dce5c44c authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

adding learning object publisher

parent caa28dd3
No related branches found
No related tags found
No related merge requests found
require 'dspace'
class DspaceService
@config = nil
def self.create_client
config
dspace_client = Dspace::Client.new(dspace_api: @config['link'])
dspace_client.login @config['login'], @config['password']
dspace_client = Dspace::Client.new(dspace_api: config['link'])
dspace_client.login config['login'], config['password']
dspace_client
end
def self.link
config
@config['link']
config['link']
end
private
def self.config
if @config.nil?
@config = {}
if Rails.env.production?
@config['link'] = "https://#{ENV['PORTALMEC_DSPACE_HOST']}:#{ENV['PORTALMEC_DSPACE_PORT']}"
@config['login'] = ENV['PORTALMEC_DSPACE_LOGIN']
@config['password'] = ENV['PORTALMEC_DSPACE_PASSWORD']
else
yml_file = YAML.load_file(Rails.root.join('config').to_s.concat('/dspace.yml'))
yml = yml_file.fetch(Rails.env)
@config['link'] = "https://#{yml['host']}:#{yml['port']}"
@config['login'] = yml['login']
@config['password'] = yml['password']
end
@config = {}
if Rails.env.production?
@config['link'] = "https://#{ENV['PORTALMEC_DSPACE_HOST']}:#{ENV['PORTALMEC_DSPACE_PORT']}"
@config['login'] = ENV['PORTALMEC_DSPACE_LOGIN']
@config['password'] = ENV['PORTALMEC_DSPACE_PASSWORD']
else
yml_file = YAML.load_file(Rails.root.join('config').to_s.concat('/dspace.yml'))
yml = yml_file.fetch(Rails.env)
@config['link'] = "https://#{yml['host']}:#{yml['port']}"
@config['login'] = yml['login']
@config['password'] = yml['password']
end
end
end
class LearningObjectPublisher
def initialize(dspace_client)
@dspace = dspace_client
end
end
\ No newline at end of file
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