reference-data

A gem to encapsulate reference data in Springshot's APIs

Installation

Add it to your gemfile.

gem 'reference-data', git: 'https://8bcbcee566e5e7a5d75592940d15bc9f68b84bd9:[email protected]/springshot/reference-data.git'

Documentation

Look up remote reference data (configured in config/reference-data.yml) from multiple resources using a single interface:

ReferenceData.lookup('referenceOne', 123) => { 'a' => 'hash' }

Configuration

The configuration file (config/reference-data.yml) is loaded first as an ERB template to parse any locally defined authentication data or other mutable request formats. E.g. if a resource requires you to log in for an authentication token, you can write a method to return that token and pass that to the reference-data.yml config via ERB.

key is used to substitute in the passed reference value. More complex queries are not yet supported.

If a request fails ReferenceData will attempt to reload the config and try the inquiry with refreshed credentials.

referenceOne:
  resource_url: http://staging.test.com/service/<%= Test.token %>/{key}

referenceTwo:
  resource_url: http://staging.test.com/api/v1/resource/{key}?app_key=<%= Test.api_key %>