G5 Foundation Client

Build Status

A Ruby gem to access G5 services, including g5-hub.


Include g5_foundation_client in your Gemfile, or manually install with rubygems.


Before you can run any of the code below, your environment must be configured as G5 Authentication Client expects.

It's pretty limited right now. You may fetch a Location given a UID, which must point to a G5 Hub Location detail page.

> model = G5FoundationClient::Location.find_by_uid("http://example.com/clients/g5-c-123-test/locations/g5-cl-123-test")
=> #<G5FoundationClient::Location:0x007f4aa8c25ef8
 @name="Location Name",
> model.attributes
=> {:uid=>
 :name=>"Test Name",

If this gets much more complicated – and it will – you should probably use YARD and point to rdoc.info, or whatever documentation builder you set up.


Some helpers methods are available to use (if you're using Rspec) by adding the following to spec_helper:

require 'g5_foundation_client/rspec'

If your environment includes FactoryGirl, this will also require some factory definitions. You probably want this.

This will give you a method to stub finding a G5FoundationClient::Location and G5FoundationClient::Client. Basic example:

  G5FoundationClient::Location.new(name: "My Location")

If you have FactoryGirl, you can omit the second argument and it will build one for you. The stub_location_for_uid method (as well as its counterpart for clients) will return the built model, which can pair nicely with a let! call to both build and stub in one shot.


Create a Github pull request. Please make sure that Travis CI passes before you do.