Couple bonuses here:
- There are two different source code files. I separate authentication from data loading. You can just as well use authenticate_fitbit.rb as a shortcut to authenticate into FitBit using OAuth, for your own purposes. Maybe loading in your other body measurements or calorie counts. Then copy the first half of load_livestrong for cues on setting up the access token, and then using it to manipulate the API.
- Your access token is stored in a created file, auth.yml. You can then play with load_livestrong at will, without having to go through the entire OAuth process for each run.
- Here's the API documentation. I'm only using the endpoint for creating body weight measurements.
IMPORTANT: You MUST set FITBIT_KEY and FITBIT_SECRET environment variables before running these scripts. Make sure you don't share those with anyone if forking these scripts. You can request keys here.
License: GPLv3, all the way. If you extend my code, I want to see your edits. I'm willing to hear if you want to negotiate on the license for business reasons; I just like sharing my code, that's all. :-)