thewalters-ruby¶ ↑
A Ruby gem for communicating with The Walters API. (Documentation)
<img src=“https://travis-ci.org/WaltersArtMuseum/thewalters-ruby.png?branch=master” alt=“Build Status” /> <img src=“https://gemnasium.com/WaltersArtMuseum/thewalters-ruby.png” alt=“Dependency Status” />
Install¶ ↑
Via rubygems.org:
gem install thewalters
Via bundler in a Gemfile:
gem "thewalters"
Accessing the REST API¶ ↑
require 'thewalters' TheWalters.apikey = "<your API key>" # register at http://api.thewalters.org/
Objects: pieces of art in the museum¶ ↑
all_objects = TheWalters::ArtObject.all first_object = all_objects["Items"].first an_object = TheWalters::ArtObject.find(756)
all
returns a metadata object, the attribute Items
contains the array of ruby objects. Each object has all the API attributes on it, accessible as attributes (object.id
) or in hash-notation (object). find
returns a single ruby object, with all of the attributes on it.
An Object has many associated images¶ ↑
images = an_object.images normal = images.first.url
Images can be modified on the fly, see github.com/WaltersArtMuseum/walters-api/blob/master/images.md¶ ↑
thumb = images.first.url(:width => 100)
All requests for lists are paginated¶ ↑
page = TheWalters::ArtObject.all(:Page => 1, :pageSize => 10) has_another_page = page.NextPage
Collections: Objects grouped by culture, and sometimes date¶ ↑
all_collections = TheWalters::Collection.all a_collection = all_collections["Items"].first objects_in_collection = a_collection.objects
Exhibitions: an organized display of objects¶ ↑
all_exhibitions = TheWalters::Exhibition.all an_exhibition = all_exhibitions["Items"].first objects_in_exhibition = an_exhibition.objects
Geographies: where an object was created or discovered¶ ↑
all_geographies = TheWalters::Geography.all a_geography = all_geographies["Items"].first objects_in_geography = a_geography.objects
Museum Locations: rooms, buildings, etc¶ ↑
all_locations = TheWalters::Locations.all a_location = all_locations["Items"].first objects_in_location = a_location.objects
See The Walters API at api.thewalters.org/help/index for the most up-to-date documentation.
Contributing to thewalters-ruby¶ ↑
The goal is to have a fully-featured API client available for attendees of ArtBytes 2014. Are you planning to use this gem? Does it meet your needs? Let @jjulian know.
Things that need to be done¶ ↑
-
Add more tests
-
Fix any open issues
Do’s and Don’ts¶ ↑
-
Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.
-
Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.
-
Fork the project.
-
Start a feature/bugfix branch.
-
Commit and push until you are happy with your contribution.
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright¶ ↑
Copyright © 2014 Jonathan Julian. See LICENSE.txt for further details.