Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default client, accessible through TempoDB module #28

Open
wants to merge 5 commits into
base: v1.0
Choose a base branch
from
Open

Add default client, accessible through TempoDB module #28

wants to merge 5 commits into from

Conversation

gevans
Copy link

@gevans gevans commented Jun 13, 2014

I've added the ability to use a default client in applications which have only one database and a single set of keys. In one particular use case, in a Rails initializer, one would be able to use:

TempoDB.configure do |config|
  config.database_id = ENV['TEMPODB_DATABASE_ID']
  config.api_key     = ENV['TEMPODB_API_KEY']
  config.api_secret  = ENV['TEMPODB_API_SECRET']
end

Standard TempoDB::Client instance methods can then be called as class methods of TempoDB:

TempoDB.write_multi(a_bunch_of_data_points)

Edit: The test suite appeared to be broken when I initially forked the repo. I took extra care not to make any changes to TempoDB::Client until I have time to see what's up with that. The changes I've made do have specs however. :)

gevans added 5 commits June 12, 2014 15:07
* Configuring the default client is done through `TempoDB.configure`, a
  pattern found frequently in other Ruby/Rails libraries.

* The `TempoDB` module delegates `Client` methods to `TempoDB.client`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant