zokioki / fitbit_api Goto Github PK
View Code? Open in Web Editor NEWA Ruby interface to the Fitbit Web API.
License: MIT License
A Ruby interface to the Fitbit Web API.
License: MIT License
If i call the method with below params
client.activity_time_series('tracker/steps', {end_date: Date.today, period: "max"})
client.activity_time_series('tracker/steps', end_date: Date.today.iso8601, period: "1d")
i get ArgumentError (unknown keywords: end_date, period)
But if i do
client.activity_time_series('tracker/steps', end_date: Date.today.iso8601, period: "x")
i get FitbitAPI::InvalidArgumentError (Invalid period: "x". Please provide one of the following: ["1d", "7d", "30d", "1w", "1m", "3m", "6m", "1y", "max"].)
I am using ruby 2.5.1
Hello. Thanks for this Gem. I've used it in production for many years and it's been great.
In the last few weeks, we ran into an issue with activity_logs_list
.
It seems that FitBit's API will now break if an empty afterDate
is passed in with a beforeDate
. I am presuming that before FitBit silently ignored an empty afterDate
but now it raises a 400 with a bad argument.
I think the solution is to just strip empty args when making API calls. But I'm not sure enough of how you'd want to solve this to make a PR. I figure it's easier for you to do.
I've monkeypatched the method locally to just not have afterDate
as a default param and things now work again for my usecase.
Thanks!
When calling #activity_logs_list
, the response returned states that beforeDate
or afterDate
fields are missing:
{"errors": [{"errorType": "validation", "fieldName": "date", "message": "beforeDate or afterDate is required" }]}
In my callback method I have the following:
@client.get_token(params[:code])
redirect_to dashboard_path
And then on the Dashboard I have:
@devices = @client.devices
However it returns the error: undefined method 'expired?' for nil:NilClass
Looking into your gem code it looks like because the @token
is nil
it's what's causing the error when it's trying to check if it's expired. Because it hasn't been set.
However when debugging I am in fact getting a correct return from Fitbit so the tokens, etc are all being returned so that instance variable should of been set. I vendorized the gem and tried to debug it using Visual Studio code like so:
And what I'm finding is that @token
is being set fine. But when it hits the second breakpoint it's nil
causing the issue. Why is the instance variable losing the data?
Hello,
Many thanks for your work on this gem - it's been very easy to use! I'm just having one problem.
I'm using the gem in a command-line application, and currently, I am having to go through the oauth authentication again quite frequently - at least daily.
I think this is because the original tokens are expiring and I'm not using the most recent tokens for subsequent runs, as they are not currently stored persistently.
Unfortunately I can't see an easy way to do this - have I missed something? Is there a way to have the gem call back or something so that I can store new access and refresh tokens for subsequent runs?
Cheers!
When delete_favorite_activity
is called, the given activity is successfully removed from the user's favorites list, but on response MultiJson throws a MultiJson::ParseError
.
Fitbit's docs show that the expected result is an empty response body with a 204 status - such a response appears to pass when other methods are called.
Example ID to pass into method's argument: 90004
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.