GithubHelp home page GithubHelp logo

fitgem's People

Contributors

anl avatar aprihodko avatar bnadlerjr avatar bookis avatar camdub avatar chrisdambrosio avatar codebender avatar donaldgoose avatar faber avatar hagope avatar halkeye avatar jcasimir avatar kevintuhumury avatar locke23rus avatar marmarko avatar maxbeizer avatar nckpark avatar pat avatar sthanson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fitgem's Issues

Oauth2 Support

Hey, wondering if there is any plan to build Oauth2 support into the current gem? I am currently working on one and was wondering if you would be interested in integrating it into this project.

The gem I'm working on is not currently published, but you can check out the repo: https://github.com/ColDog/fitbit-oauth2

Cheers

Access to HTTP response codes

It looks like only the subscription-related APIs return the HTTP response code. This makes it difficult, when using the other APIs, to determine if an authorization error has taken place. As far as I can tell, you need to look into the result hash, test if it has an "errors" key, and, if so, look at the contents of the array that it maps to. But Fitbit returns an HTTP 401 if there is an authorization error happens. Is there a better way of getting to this information?

reconnect method results in "Invalid/expired user token"

Hello

I've followed along very closely with the code examples and the Wiki, and I'm having problems with the reconnect method.

I can successfully authorize my application the first time, then I'm updating my user to store the token and secret:

request_token = client.request_token
current_user.update(:token => request_token.token, :secret => request_token.secret)
redirect "http://www.fitbit.com/oauth/authorize?oauth_token=#{current_user.token.to_s}"

Now, when I go to reconnect I do this (the consumer key and secret are stored in my environment):

consumer_key = ENV['CONSUMER_KEY']
consumer_secret = ENV['CONSUMER_SECRET']
client = Fitgem::Client.new({:consumer_key => consumer_key,:consumer_secret => consumer_secret,:token => current_user.token,:secret => current_user.secret})
access_token = client.reconnect(current_user.token, current_user.secret)
puts client.user_info.inspect

in my terminal I get:

=> {"errors"=>[{"errorType"=>"oauth", "fieldName"=>"oauth_access_token", "message"=>"Invalid/expired user token: efd76cc6915c3ce345a43437c952403a"}]}

I don't see what I'm doing wrong - could this be a bug?

question about omniauth

I wasn't sure where to ask this question, I tried posting it to your github email but it bounced :(, so apologies for writing this here.

I've been looking at Fitbit ruby libraries and your contribution obviously stands out.

I was thinking it might make sense to try make Fitbit Accounts work as an omniauth strategy (like you'll see here: https://github.com/intridea/omniauth/tree/master/oa-oauth/lib/omniauth/strategies
and then save the account records into my regular Accounts table (which I'd make :omniauthable with devise), perhaps adding a "source" and/or "source_type" fields to distinguish it from a regular Account.

I wondered if you had any thoughts about this approach of if you have considered it?

Thanks!

Can't get authentication working

Hi,
Thanks so much for putting this gem out there. I'm trying to integrate with the FB api and your work has made it much simpler!

I'm having the following issue. The initial oauth authentication seems to be working just fine. I receive and store the oauth token and secret with the user when they authorize my app. Setting up your client seems to go smoothly, however when I invoke one of the API methods, I get the following. What am I doing wrong?:

=> {"errors"=>
[{"errorType"=>"oauth",
"fieldName"=>"oauth_access_token",
"message"=>
"Invalid signature or token '/WXdJVXivN3OuIXl16I7ZOAHpUQ=' or token '76db9d2bf0201e0d6f91f302d5a118e4'"}],
"success"=>false}

Time series on body measurements

    def body_series type, opts = {}
      get determine_body_uri("/user/#{@user_id}/body/#{type}", opts)
    end

Let me know if you want a proper pull request. I just monkey patched this into my client code.

Use https always

Fitbit api will be restricted to https only from November 3, 2014:

On Monday, November 3, 2014, connections to api.fitbit.com will be restricted to HTTPS connections only. TLS (“SSL”) will be required to use all api.fitbit.com endpoints, including all steps of OAuth.

TLS creates a secure communication channel between your application and Fitbit’s API. If your application uses plaintext HTTP connections to access the Fitbit API, you need to update it to use HTTPS immediately.

For most applications, changing http:// to https:// on requests to api.fitbit.com and redirects to www.fitbit.com is all that is necessary to comply with this requirement.

The Fitbit API will return a HTTP 403 error to all non-HTTPS requests starting on November 3, 2014.

A “blackout test” will be performed on Tuesday, October 7, 2014. Non-HTTPS requests will fail for a brief period of time. This time will be announced in the API support forum and status page.

If you have questions about securely connecting to Fitbit’s API, please post them in our support forum.

Date range support?

It looks like most of the data retrieval methods only support requests for a specific date. The FitBit API-Get-Time-Series accepts calls for either a specific date, or date ranges https://wiki.fitbit.com/display/API/API-Get-Time-Series. But the methods are using a single date with the format_date() helper.

It would be great if ranges and duration were supported, e.g. calls such as:

GET /1/user/-/activities/steps/date/today/1m.json
GET /1/user/-/foods/log/caloriesIn/date/2010-08-11/2010-08-15.json

Fitbit API has changed

I received this:

Why you are receiving this notice: You have an application registered to use the Fitbit API at https://dev.fitbit.com and the following changes may affect your application.

  1. Heart rate time series will now only include data points when Fitbit believes the device was being worn. This change affects all heart rate data ever captured by a Fitbit device. You might consider re-requesting heart rate data retrieved prior to July 25, 2015.
  2. Your application should consider all numerical ids in the Fitbit API to be unsigned 64 bit integers. Many ids will cross the maximum 32 bit integer in the next couple of weeks.
  3. OAuth 2.0 requests will be restricted to JSON and TCX formats. XML will no longer be supported with OAuth 2.0 requests starting August 17, 2015.
  4. The custom logging endpoints (deprecated in October 2014) will be removed on August 27, 2015.
    API-Get-Heart-Rate (e.g. GET /1/user/-/heart/date/2010-02-21.json, replaced with heart rate time series)
    API-Log-Heart-Rate (e.g. POST /1/user/-/heart.json)
    API-Delete-Heart-Rate-Log (e.g. DELETE /1/user/-/heart/123.json)
    API-Get-Blood-Pressure (e.g. GET /1/user/-/bp/date/2010-02-21.json)
    API-Log-Blood-Pressure (e.g. POST /1/user/-/bp.json)
    API-Delete-Blood-Pressure-Log (e.g. DELETE /1/user/-/bp/123.json)
    API-Get-Glucose (e.g. GET /1/user/-/glucose/date/2010-02-21.json)
    API-Log-Glucose (e.g. POST /1/user/-/glucose.json)
    API-Get-Body-Measurements (e.g. GET /1/user/-/body/date/2010-02-21.json)
    API-Log-Body-Measurements (e.g. POST /1/user/-/body.json)
    All measurements except fat and weight will be removed from API-Get-Body-Measurements (e.g. GET /1/user/-/body/date/2010-02-21.json) and API-Log-Body-Measurements (e.g. POST /1/user/-/body.json)
    If you have questions, please post in the Web API support forum. If you have a confidential inquiry, please email us.

I think this gem is not working anymore, I cant dwonload any data from Fitbit API.

fitgem.gemspec is missing version.rb

I emailed you yesterday about a problem with loading the gem. I was getting the message "no such file to load -- fitgem/version". I was comparing what was in my directory to the git repository and noticed that version.rb was missing in my install (used gem install fitgem).

When I manually created the file in my directory, I no longer got the error.

I think this might be because fitgem.gemspec is missing version.rb in the s.files section (I am new to ruby but it is the only thing I can think of).

Upgrade for OAuth 2.0

Just to bump the issue already raised with #44 and the switch isn't too far in the future. Is there any recommendation on which alternative Gem to use?

Authorize URL should not be under api.fitbit.com

According to the Fitbit documentation, in order for the users to authorize the client application, users should be redirected to:
https://www.fitbit.com/oauth/authorize?oauth_token=[&locale=][&display=touch][&requestCredentials=true]

With the current configuration, it seems like users are being redirected to https://api.fitbit.com/oauth/authorize.

According to fitbit support, there are two reasons to use the non-api URL:

  1. When you send people to api.fitbit.com, they are always required to sign in to authorize your app. When your app uses the correct URL, people do not have to sign in if they are already signed in on the device.
  2. While Fitbit has supported authorization on api.fitbit.com, soon it will begin redirecting these requests to www.fitbit.com, which will increase the page load time for your users.

RE: Is there still a maintainer on this gem

Hey just wondering whether this gem is still maintained, i am using it in one production project and need to PR a small change as well as get the heart rate data in there, wondering if i can merge the PR and PR to expose the generic #get

DateTime format for data_by_time_range

I know it works with Date format, But i need the datetime format

what is the DateTime format to pass for data_by_time_range method.
I used (Time.now - n.hours).to_datetime
(Time.now + n.hours).strftime('%Y-%m-%dT%H:%M:%S')
I have tried almost all possiblities i get errors

URI::InvalidURIError: bad URI(is not URI?): /1/user/-/activities/log/steps/date/2013-02-27 13:32:11/2013-02-28 13:32:39.json

{"errors"=>[{"errorType"=>"request", "fieldName"=>"n/a", "message"=>"Either "activityId" or "activityName" should be present"}]}

Prepare for deprecation of API methods

From the Fitbit API documentation:

Custom Logging Endpoints

The following API endpoints are deprecated and will be removed at a future date:

  • API-Get-Heart-Rate (will be replaced with heart rate time series endpoints)
  • API-Log-Heart-Rate
  • API-Delete-Heart-Rate-Log
  • API-Get-Blood-Pressure
  • API-Log-Blood-Pressure
  • API-Delete-Blood-Pressure-Log
  • API-Get-Glucose
  • API-Log-Glucose
  • API-Get-Body-Measurements
  • API-Log-Body-Measurements

All measurements except fat and weight will be removed from:

  • API-Get-Body-Measurements
  • API-Log-Body-Measurements

We're going to need to figure out how we're going to handle the deprecation. In the past I've retained the methods in the gem but raised DeprecatedApiError with a message.

For the next minor version bump we'll add Kernel#warn messages about the future deprecation, and then a minor or major version bump when they ultimately remove the functionality from the API. The issue is that we hadn't bumped the gem to v1.0.0 yet because the API was still in Beta and more breaking changes may have been anticipated. I need to find out how Fitbit classifies the API at this point, as our version structure should broadly mirror the service it proxies.

intraday_time_series for minutesVeryActive?

You can make a request like this to the api.

/activities/minutesVeryActive/date/2013-07-11/1d/time/4:00/23:00.json

I'm not seeing now to do that with the current gem. Also is there anyway you can expose the raw_get so we can just make requests if somethings' not supported

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.