hudmol/archivesspace — pull request #349 by payten (2013-03-26 03:31:46+00:00)
Title: Reports in the backend

This implementation sees each report offer an endpoint to access the report and a ruby class to query and format the report data.

I've added a report_helper that offers a response handler for all the formats - namely json, csv, xlsx, pdf and standard erb for html.

For xlsx, I've pulled in the axlsx gem.
For pdf, there's the Flying Saucer library.

To support the html and pdf formats, there's some new erb templates. The styles are currently inline so they can be delivered to the frontend.

I've also added a new config entry for the report page size, as I presume 'letter', 'A4' and others will be preferred in different locations (this is required for the PDF formatter) -
AppConfig[:report_page_size] = "A4"

Our first report lists all accessions created within a range - here's an example URI: http://localhost:4567/reports/created_accessions?from=20111001&to=20130501&format=csv

I'm not sure how to best deliver these in the frontend yet. Perhaps each report needs to "register" itself as an endpoint. We could then offer an available reports listing to the frontend.

Alternatively, we may just need to add handlers/forms in the frontend explicitly for each.

Something for the next working bee.