= Dbla
Access DPLA's API via the Blacklight search interface.
- Generate a Blacklight app:
$ rails new search_app -m https://raw.github.com/projectblacklight/blacklight/master/template.demo.rb
$ cd search_app
- Add the dbla gem to the Gemfile:
gem "dbla"
and bundle install.
- Run the dbla generators:
$ rails g dbla:install
- Create a config/dpla.yml file of the form
api_key: <your-api-key
api_email: <your-email-that-you-used-for-your-api-key>
url: http://api.dp.la/v2/
Find out how to request your DPLA API key
This file can be stubbed out with a rake task:
$ rake dbla:key:get [email protected]
# get your email from DPLA
$ rake dbla:key:config key=YOURKEY00000000
- Configure the CatalogController
Replace the following code in your CatalogController:
# solr field configuration for search results/index views
config.index.title_field = 'title_display'
config.index.display_type_field = 'format'
With Dbla options.
config.repository_class = Dbla::Repository
config.document_model = Item
config.response_model = Dbla::Response
config.document_presenter_class = Dbla::DocumentPresenter
# solr field configuration for search results/index views
config.index.title_field = 'sourceResource/title'
config.index.thumbnail_field = 'object'
config.index.display_type_field = 'format'
... or just copy the most recent mimicry of the DP.LA portal:
rails g dbla:catalog
- Fire it up!
$ rails s
Open your browser and go to localhost:3000.
Search for kittens!