I recently released a new gem simply titled "familysearch". The functionality is pretty simple at this point, but it should work for getting someone started on the new Platform API.
This gem takes a bit different approach than the ruby-fs-stack gem, in that it tries to make use of the HATEOAS principles the best as it can. It uses the awesome 'faraday' gem under the covers for managing the http requests.
Please go take a look and give feedback.
Current functionality:
- Instantiate a FamilySearch::Client object, which handles your standard http methods (GET, POST, PUT, DELETE, etc.)
- Basic Auth: Though this shouldn't be used in a web application—it is simply there for testing and to help you get started.
- Maintains access_token on the client object for future requests
- Discovery Resource loading
- URI Templates
- Parses responses into a ruby Hash
- Sets Authorization and Accept headers for you
- Tested via RSpec
Future (my wishlist):
Better Objects
I'd like to get the ruby Hashes into more intelligent objects. At first, I attempted to just use Hashie (Rash). So that I could easily traverse object structures while avoiding nil traps in the path. This could potentially work, though an earlier Hashie version is a dependency on the omniauth gem—which I figure other developers might be using. The earlier Hashie doesn't give the nil protection benefits.
I've considered using the ruby serialization code generated by enunciate and offered by the Platform directly. This is how ruby-fs-stack works, but there were some things that I wasn't necessarily thrilled about. I'd probably just need to work with Ryan to get the generated ruby code reworked.
I've considered creating a separate gem familysearch-gedcomx, which would contain the data model for GedcomX, including the FamilySearch extensions. This could be hand-written, or use some clever tricks to populate objects from a Hash.
Anyone have ideas here?
Ancestry Utilities
The Platform offers up Ancestry objects in an Ahnentafel numbering schematic. I'd like to provide some utilities for parsing, and stitching together pedigrees.
Object Creation Helpers
One of the things I really liked about ruby-fs-stack was the helper methods for constructing the rich object structure that represents a person. Along with simply providing better objects, I'd like to have some helper methods for adding names, events, facts, etc. Today, you should be able to create objects with the gem by creating Hash objects and serializing them to JSON. I'd like to have something nicer.
Travis CI Testing
I'd like to have this gem on a continuous integration build system like
https://travis-ci.org/. That way, we can ensure that the project continues to pass its tests on a variety of Ruby engines. Does anyone have experience setting this up? It doesn't look that complicated, I just have never done this before.
Better Faraday Middleware Access
Faraday middleware allows you to do some really cool stuff within the stack of an HTTP request. The gem doesn't currently have a nice interface for inserting your own faraday middleware.
Asynchronous HTTP
Faraday supports asynchronous http calls via em-http-request support, but I haven't tried or tested this. Is anyone using an evented ruby environment that would need this?
What would you like to see?
Please file bugs and enhancement requests on the Github issue tracker. Fork the project and send me pull requests.
--
Jimmy Zimmerman