Edinburgh International Book Festival mobile website
** View builds | master: | stage: | production: **
What is this?
This is the application behind the Edinburgh International Book Festival 2011 mobile website at m.edbookfest.co.uk which was developed by James Newbery of Tinned Fruit Ltd. The project originated at Culture Hack Scotland and was supported by the Edinburgh Festivals Innovation Lab.
m.edbookfest.co.uk mobile website application Copyright © 2011 Edinburgh International Book Festival Ltd
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
If used for the purpose of creating a public website, we ask that - in addition to the requirements of the GNU GPL - future users of this application include an acknowledgement within the credits or information section of their own site as follows:
This website makes use of technology developed by Tinned Fruit Ltd (www.tinnedfruit.com) for the Edinburgh International Book Festival Ltd (www.edbookfest.co.uk) with the support of the Edinburgh Festivals Innovation Lab and Culture Hack Scotland.
This credit should also be included as a meta-tag within the
<head> element of all pages within the site.
This acknowledgement is non-contractual, but it is a condition of licence that the request be distributed verbatim as part of the original licence terms.
We are keen to see other cultural organisations building on what we've done, and are happy to answer questions and provide further information if required. In the first instance, please contact firstname.lastname@example.org.
If you do find the code useful, we'd love to hear from you. Drop us a note at the Book Festival, via @acoulton or @festivalslab on twitter, or through the festivalslab organisation on GitHub
The application combines data from a number of sources:
- The Edinburgh International Book Festival programme listings data
- Edinburgh International Book Festival bookshop stock data
- Amazon Product Advertising API
- Guardian Open Platform Content API
- iTunes Search API
All external APIs are open access - with the relevant keys and subject to terms and conditions - and details are available on the linked pages above.
Edinburgh International Book Festival programme listings data
This is a superset of the real-time data provided to the Edinburgh Festivals Listings API which includes meta-data on related authors and books as well as more detailed data on pricing, sponsors, titles and subtitles in festival-specific format (elements of which are concatenated to fit the cross-festival API data format).
The data is served as a single XML document, protected by standard HTTP Basic Authentication, and the Book Festival are happy to discuss providing access - subject to acceptable use policy - to other developers and consumers. The XML schema for this document is provided within the /docs folder of this repository, as is an archive copy of the 2011 XML document for development, testing and review purposes. Please note that URLs listed within the document are not guaranteed to be persistent and may become unavailable over time. Under no circumstances should this data be used other than for experimentation. To discuss access to live data, or other usage of archive data, contact Andrew Coulton.
Edinburgh International Book Festival bookshop stock data
This is a feed from the Book Festival's independent Bookshops' stock control system, again provided in XML format and containing details of every title ordered for stock in the bookshops (which includes backlist titles, and general stock not related to current events).
It is served in XML format over HTTP, and again the Book Festival is happy to discuss providing access to other users. The XML schema is provided within the /docs folder of this repository, and as above an archive copy of the 2011 XML document is also available.
The Edinburgh International Book Festival mobile app is a Ruby on Rails 3.1 application. Installing and setting up for local development follows the standard path for Rails applications.
- Ruby 1.9.2 - suggest using RVM to manage Ruby versions and gemsets
- Bundler (
gem install bundler)
- Chrome WebDriver for running some Cucumber features - note that this can be installed with "sudo ./install_chrome_webdriver" in the project root directory. A physical display, or an emulator such as xvfb is required - see the Travis configuration for a usage example.
The following instructions are for Mac OS X, but should also work for Linux. Windows users may have to be creative.
- Fork / clone this repo using
git clone(use GitHub's help if you are not familiar with Git)
- At this point, if you have RVM installed, it will prompt you to create a project-specific gemset named 'edbookfest-mobile'.
- From the project root,
bundle installto install required gems.
rake db:migrateto run database migrations
- To run the application locally, run
rails server. You should see a festival calendar when visiting the home page. There will be no data in the application at this point.
There is a basic rake task to create some fake events data, but this does not currently include featured authors or books. Run
Programme listings data
If you would like to have access to the EIBF programme listings data feed, please see the above section on obtaining access credentials.
Listings data are consumed over HTTP via a rake task to import and update the database. The task requires the presence of these environment variables:
EIBF_FEED_URL- full URL to the XML events feed
EIBF_FEED_USERNAME- HTTP basic authentication username for feed
EIBF_FEED_PASSWORD- HTTP basic authentication password for feed
rake listings:import will create or update event listings, featured authors and featured books from the feed.
Edinburgh International Book Festival bookshop stock data is also available as a feed. Stock data is imported in a separate rake task, and requires the following environment variable:
EIBF_STOCK_URL- full URL to the XML stock feed
rake stock:import creates or updates book entries in the local database.
Some of the key gems used in the project:
- Calendar Helper is used to generate the calendar
- Nokogiri is used for consuming and parsing XML feeds
- httparty is used for consuming JSON api responses
- Sucker (now Amazon Product) is used to interact with the Amazon Product Advertising API
Tests are run in the usual way:
rakewill run all Cucumber examples and the RSpec suite
rake cucumberruns just the cucumber examples
rake specruns just the RSpec suite