DON'T MERGE - Accelerate the Gallery API

Accelerate the Gallery API

* Pull out data in raw SQL, massage in Ruby to get the format needed by the API
* uses new hash_refinement.rb, removes several methods from array_refinement.rb

Spec failures kept popping up on unrelated (very old) code, fixed those as well.  Those mostly consisted of leaky state.

* [CYB-324 Gallery Performance: refactor API to return results faster](https://jira.ets.berkeley.edu/jira/browse/CYB-324)
* [CYB-338 Add API endpoint for single gallery item](https://jira.ets.berkeley.edu/jira/browse/CYB-338)
* [CYB-339 Remove comments json from gallery index API endpoint](https://jira.ets.berkeley.edu/jira/browse/CYB-339)
Yes, that absolutely make sense, perhaps as a Presenter class.  The only question is time and priorities for it.  I had thought of putting it in a file that's loaded, just the SQL itself, but a Presenter would make most sense.   There are too many models involved to use a Decorator (there isn't even one that would be the base ... Attachment and MediaUrl are the closest, but even then that is two).