def initialize(end_point, username, password)
logger.debug "Connecting to #{end_point}" if @mydebug
credentials = Base64.encode64("#{username}:#{password}")
@@headers["Authorization"] = "Basic #{credentials}"
RestClient.proxy = ENV['http_proxy']
request = RestClient::Request.new(:url => end_point, :method => :get, :headers => @@headers)
begin
response = request.execute
result = JSON.parse(response)
@links = send(request)
rescue RestClient::ExceptionWithResponse => e
logger.error "Failed to get API #{e.response}"
rescue Exception => e
raise ResourceAccessException.new("Resource could not be accessed:#{e.message}")
end
end