MoriTanosuke / FitbitAnalyzr

Simple application that lets you analyze your logged data on http://fitbit.com
http://fitbitanalyzr.herokuapp.com/
2 stars 0 forks source link

Update resource after receiving subscription notification #13

Closed MoriTanosuke closed 12 years ago

MoriTanosuke commented 12 years ago

When receiving a notification form the Subscription API the application should update the notified resource on behalf of the user.

Example notification is

        [
            {
              "collectionType":"foods",
              "date":"2010-03-01",
              "ownerId":"228S74",
              "ownerType":"user",
              "subscriptionId":"1234",
            },
            {
              "collectionType":"foods",
              "date":"2010-03-02",
              "ownerId":"228S74",
              "ownerType":"user",
              "subscriptionId":"1234",
            },
            {

              "collectionType":"activities",
              "date":"2010-03-01",
              "ownerId":"184X36",
              "ownerType":"user",
              "subscriptionId":"2345",
            }
        ]

I think we should then go and update the resources based on collectionType and date. What I don't know yet is how we get from collectionType to a real TimeSeries. Some kind of mapping is involved here...

MoriTanosuke commented 12 years ago

Ok, the DEV wiki says that we should update the resource from http://api.fitbit.com/user/184X36/activities/date/2010-03-01.json. We don't have the user ID 184X36, but we have the OAuth from our user and the user ID from the subscriptionId. That should be sufficient to update the resource.