whazzing around

a thing on the internet

Fitgem v0.3.6

| Comments

On October 14th Fitbit announced the latest version of their API, including support for features of their new Fitbit Ultra tracker hardware.

Source | Gem | Issues | Documentation

Updates

Floors and elevation info from activities_on_date

pp client.activities_on_date("2011-10-24")
{"activities"=>
  [{"activityId"=>2130,
    "activityParentId"=>2130,
    "activityParentName"=>
     "Weight lifting (free, nautilus or universal-type), light or moderate effort, light workout, general",
    "calories"=>228,
    "description"=>"",
    "duration"=>3600000,
    "hasStartTime"=>true,
    "isFavorite"=>true,
    "logId"=>2136964,
    "name"=>
     "Weight lifting (free, nautilus or universal-type), light or moderate effort, light workout, general",
    "startTime"=>"16:15"}],
 "goals"=>
  {"activeScore"=>1000,
   "caloriesOut"=>2911,
   "distance"=>5,
   "floors"=>10,
   "steps"=>10000},
 "summary"=>
  {"activeScore"=>495,
   "activityCalories"=>927,
   "caloriesOut"=>2458,
   "distances"=>
    [{"activity"=>"total", "distance"=>2.07},
     {"activity"=>"tracker", "distance"=>2.07},
     {"activity"=>"loggedActivities", "distance"=>0},
     {"activity"=>"veryActive", "distance"=>0.3},
     {"activity"=>"moderatelyActive", "distance"=>0.68},
     {"activity"=>"lightlyActive", "distance"=>1.09},
     {"activity"=>"sedentaryActive", "distance"=>0},
     {"activity"=>
       "Weight lifting (free, nautilus or universal-type), light or moderate effort, light workout, general",
      "distance"=>0}],
   "elevation"=>90,
   "fairlyActiveMinutes"=>118,
   "floors"=>9,
   "lightlyActiveMinutes"=>102,
   "marginalCalories"=>562,
   "sedentaryMinutes"=>1210,
   "steps"=>4590,
   "veryActiveMinutes"=>10}
}

Floors and elevation info from data_by_time_range

pp client.data_by_time_range("/activities/log/floors", {:base_date => "2011-10-24", :period => "1d"})
{"activities-log-floors"=>[{"dateTime"=>"2011-10-24", "value"=>"9"}]}

Food Goals now available through the foods_on_date method

pp client.foods_on_date("2011-10-24")
{"foods"=>[],
 "goals"=>{"calories"=>2911},
 "summary"=>
  {"calories"=>0,
   "carbs"=>0,
   "fat"=>0,
   "fiber"=>0,
   "protein"=>0,
   "sodium"=>0,
   "water"=>0}
}

Device info now returns lastSyncTime

pp client.devices
[{"battery"=>"Full",
  "id"=>*****,
  "lastSyncTime"=>"2011-10-25T09:54:40.000",
  "type"=>"TRACKER"}]

Get details on a food with new method food_info

There is a new method that will fetch detailed food information given a food ID. Food IDs are generally retrieved by searching for a food using find_food.

# Get food info for an apple
pp client.food_info 20711
{"food"=>
  {"accessLevel"=>"PUBLIC",
   "brand"=>"Shoney's",
   "calories"=>81,
   "defaultServingSize"=>5,
   "defaultUnit"=>{"id"=>226, "name"=>"oz", "plural"=>"oz"},
   "foodId"=>20711,
   "name"=>"Apple",
   "units"=>[226, 180, 147, 389]}
}

Calories now returned in find_food results

pp client.find_food("GoLean Raisin Bran Crunch Cereal")
{"foods"=>
  [{"accessLevel"=>"PUBLIC",
    "brand"=>"Kellogg's",
    "calories"=>110,
    "defaultServingSize"=>1,
    "defaultUnit"=>{"id"=>17, "name"=>"bar", "plural"=>"bars"},
    "foodId"=>20942,
    "name"=>"Cereal Bar, Raisin Bran Crunch",
    "units"=>[17]},
   {"accessLevel"=>"PUBLIC",
    "brand"=>"Safeway",
    "calories"=>230,
    "defaultServingSize"=>1,
    "defaultUnit"=>{"id"=>304, "name"=>"serving", "plural"=>"servings"},
    "foodId"=>79051,
    "name"=>"Raisin Bran Crunch Cereal",
    "units"=>[304, 91, 256, 279]}]
}