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” />
Via rubygems.org:
gem install thewalters
Via bundler in a Gemfile:
gem "thewalters"
require 'thewalters' TheWalters.apikey = "<your API key>" # register at http://api.thewalters.org/
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.
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)
page = TheWalters::ArtObject.all(:Page => 1, :pageSize => 10) has_another_page = page.NextPage
all_collections = TheWalters::Collection.all a_collection = all_collections["Items"].first objects_in_collection = a_collection.objects
all_exhibitions = TheWalters::Exhibition.all an_exhibition = all_exhibitions["Items"].first objects_in_exhibition = an_exhibition.objects
all_geographies = TheWalters::Geography.all a_geography = all_geographies["Items"].first objects_in_geography = a_geography.objects
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.
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.
-
Add more tests
-
Fix any open issues
-
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 © 2014 Jonathan Julian. See LICENSE.txt for further details.