Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.
/ blacklight_with_eds Public archive

Blacklight Instance with EDS API Results in an Articles tab

Notifications You must be signed in to change notification settings

ebsco/blacklight_with_eds

Repository files navigation

This repo is deprecated. For other code for Blacklight and EDS, see:


This repository contains a full Blacklight instance. You can use it, or if you have an existing Blacklight instance, you can simply download these files and make the following changes.

Add the following files in the noted locations:

articles FOLDER to app/views/articles
articles_helper.rb to app/helpers/articles_helper.rb
articles_helper_behavior.rb to app/helpers/blacklight/articles_helper_behavior.rb
articles_controller.rb to app/controllers/articles_controller.rb
APIauthentication.txt to root of blacklight
token.txt to root of blacklight

CSS:

_default_ebsco_theme.css.scss containts the required CSS styling to show EDS pubtype icons and "loading" circle when a checkbox is clicked

Append the following to Blacklight’s Gemfile, then BUNDLE INSTALL:

gem "ebsco-discovery-service-api", "1.0.3"
gem "addressable", "2.3.2"
gem "htmlentities"
gem "Sanitize"

Edit config/routes.rb to include:

match 'articles' => 'articles#index'
match 'articles/:dbid/:an' => 'articles#detail', :constraints  => { :an => /[^\/]+/ }
match 'articles/:dbid/:an/fulltext' => 'articles#fulltext', :constraints  => { :an => /[^\/]+/ }
match 'articles/switch/' => 'articles#recordSwitch'

Edit app/controllers/application_controller.rb to include:

def after_sign_in_path_for(resource)
  if session[:session_key].present?
    connection = EDSApi::ConnectionHandler.new(2)
    connection.end_session(session[:session_key])
    session[:session_key] = nil
  end
  if session[:results].present?
    session[:results] = nil
  end
  if session[:current_url].present?
    session[:current_url]
  end
end

def after_sign_out_path_for(resource)
  if session[:session_key].present?
    connection = EDSApi::ConnectionHandler.new(2)
    connection.end_session(session[:session_key])
    session[:session_key] = nil
  end
  if session[:results].present?
    session[:results] = nil
  end
  root_path
end

Finally, ensure that session information is stored in the DB, not in COOKIES. From the command line…

rake db:sessions:create
rake db:migrate

…and then in config/initializers/session_store.rb, change

(App)::Application.config.session_store :cookie_store, :key => 'xxx'

to

(App)::Application.config.session_store :active_record_store

This instance requires authentication (via Blacklight) in order for access to be granted to the “articles” portion, as it provides full text access to articles. Guest mode coming soon.

Finally, you’ll need to have an EDS API profile in EBSCOadmin. You can request this at eds@ebscohost.com, or you can create a new EDS API profile yourself using the PROFILE MAINTENANCE FEATURE. Be sure you add content to your EDS API profile (via the DATABASES tab) so it will return results. Create a userID and password to access your API profile in the AUTHENTICATION tab at the top of the screen. Make sure the GROUP associated with the login you create is the group that contains your EDS API profile. EBSCO Support (eds@ebscohost.com) can help you set up an EDS API profile and get a userID and password for it if you are unfamiliar with EBSCOadmin.

About

Blacklight Instance with EDS API Results in an Articles tab

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published