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

Already on GitHub? Sign in to your account

Unit System option #8

Merged
merged 4 commits into from Jan 24, 2014

Conversation

Projects
None yet
2 participants

Fixes Issue #7 by adding optional unit_system parameter in client constructor. If not specified, fitbit responses will default to the metric system (as per their API design). Also changed the test to grab the profile of the current authorized user, because I found this to be a better test of the unit system switch. The old test used a fixed date for grabbing activity data, which wasn't always guaranteed to have any data. The profile should at least show some data. Also markdown referenced directory test which does not exist. Updated to say example.

lib/fitbit_client.js
@@ -20,7 +20,7 @@ module.exports = function (api_key, api_secret, callbackURI) {
'http://api.fitbit.com/oauth/access_token',
api_key, api_secret, '1.0', callbackURI,
'HMAC-SHA1', null,
- {'Accept': '*/*', 'Connection': 'close', 'User-Agent': 'fitbit-js ' + client.version});
+ {'Accept': '*/*', 'Connection': 'close', 'User-Agent': 'fitbit-js ' + client.version, 'Accept-Language': unit_system});
@smurthas

smurthas Jan 9, 2014

Owner

So that we don't end up sending an Accept-Language: undefined header to Fitbit, could you update this to only include it if is not null and not undefined?

Owner

smurthas commented Jan 9, 2014

Thanks! I put a small request comment on there. Other than that, it looks good.

I reworked the headers to only include Accept-Language if it isn't undefined or null

smurthas added a commit that referenced this pull request Jan 24, 2014

@smurthas smurthas merged commit e3993a1 into smurthas:master Jan 24, 2014

Owner

smurthas commented Jan 24, 2014

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment