This repo is no longer supported. A Ruby interface to the EDS API that is supported: https://github.com/ebsco/edsapi-ruby - this repo flattens the EDS API response and provides a Solr interface to the API as well, making it more useful for Blacklight.
Add this line to your application's Gemfile:
Note: the gem is currently in a private repository. You'll need to get a authentication token and use the token in the git string. Follow the instructions here to get a token: [https://gist.github.com/masonforest/4048732]
TODO: Change this instruction once the repository is public
gem 'blacklight_eds', git: 'https://your_token:x-oauth-basic@github.com/ebsco/blacklight_eds_gem.git'
And then execute:
$ bundle
Or install it yourself as:
$ gem install blacklight_eds
For now, you need to manually edit some files in your blacklight app for the gem to work. We'll develop generators to take care of most of the manual steps.
TODO: Update this section once tasks are implemented to automate the setup
- Add the following to
blacklight/app/controllers/application_controller.rb
require 'ebsco-discovery-service-api'
helper BlacklightEds::Engine.helpers
- Use session store. If your blacklight app is still using cookie_store, update it to using session store.
In blacklight/Gemfile
, add a line
gem 'activerecord-session_store'
Then run
bundle install
From command line,
rails generate active_record:session_migration
Then in blacklight/config/initializers/session_store.rb
, change
(App)::Application.config.session_store :active_record_store, :key => 'xxx'
to
(App)::Application.config.session_store :active_record_store
Then run
rake db:migrate
from the command line.
- Add EDS profile
Create a file blacklight/config/eds.yml
, add the following:
defaults: &DEFAULTS
default:
username: your_eds_username
password: your_eds_password
profile: your_eds_profile
other:
...
development:
<<: *DEFAULTS
test:
<<: *DEFAULTS
production:
<<: *DEFAULTS
- Add initializer
In config/initializers, create a file called blacklight_eds.rb, and paste the following code:
yaml_file = File.join(Rails.root, 'config', 'eds.yml')
if File.exists? yaml_file
profiles = YAML.load_file(yaml_file)
if profiles.present? and profiles.has_key? Rails.env
Rails.application.config.eds_profiles = profiles[Rails.env]
else
logger.silence_warnings "No configuration found for #{Rails.env} environment in config/eds.yml"
end
else
logger.silence_stderr 'File not found: config/eds.yml'
end
- Configure routes
In blacklight/config/routes.rb
, add a line
mount BlacklightEds::Engine, at: "eds"
This will mount the blacklight_eds gem to the url [blacklight_root_url]/eds/articles
TODO: Update the config file after make the gem support multiple profiles
After checking out the repo, run bin/setup
to install dependencies. Then, run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
to create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
- Fork it ( https://github.com/[my-github-username]/blacklight_eds/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request