For convention reasons I would like to initialize the Fitgem client in config/initializers/fitgem.rb. When I say initialize I mean pass in my app's consumer token and consumer secret like so:
Fitgem.configure do |config|
config.consumer_key = "XXXX"
config.consumer_secret = "XXXX"
config.token = "XXXX"
config.secret = "XXXX"
end
This is the exact same manner that is done with Facebook and Twitter clients (https://github.com/sferik/twitter) elsewhere. Is there a similar way I can do this with Fitgem?
The error I receive when I try to initialize the client this way is:
undefined method `configure' for Fitgem:Module
The fitgem docs (http://www.rubydoc.info/github/whazzmaster/fitgem/frames) say to do it like this:
client = Fitgem::Client.new {
:consumer_key => my_key,
:consumer_secret => my_secret,
:token => fitbit_oauth_token,
:secret => fitbit_oauth_secret
}
But I don't want to have to re-initialize the Fitgem client in every method.