Project

misfit_gem

0.01
No commit activity in last 3 years
No release in over 3 years
A client library to retrieve data from misfit shine
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3.0.0

Runtime

>= 0
 Project Readme

MisfitGem

Provides access to the Misfit Shine API (http://build.misfit.com) through oAuth.

As the Misfit Shine API is currently in BETA and under development, pull requests are appreciated if API support starts to show gaps.

Installation

Install misfit_gem

$ gem install misfit_gem

or add it to your Gemfile

gem 'misfit_gem'

Authentication

Omniauth is the best way to connect your users to the Misfit API. Use omniauth-shine to integrate Misfit accounts into your web application. You will need the OAuth access_token as a minimum.

Configuration

In order to use MisfitGem you'll first need to configure a client.

@client ||= MisfitGem::Client.new(
  consumer_key: ENV["MISFIT_API_KEY"],
  consumer_secret: ENV["MISFIT_API_SECRET"],
  token: oauth_access_token
  )

Usage

See the Misfit Resource Reference for more details on request and response parameters.

Profile

Gets the current user's profile information

@client.get_profile

Device

Get the current user's device information (only returns information about one - current - device)

@client.get_device

Goal

Get the user's goals within a period.

Required: Start Date and End Date (Date object or "YYYY-MM-DD" string).

@client.get_goals(start_date: Date.today - 1.week, end_date: Date.today)

Get a specific goal.

Required: ID.

@client.get_goal(id: "12345")

Summary

Get a summary of the user's activity within a period.

Required: Start Date and End Date (Date object or "YYYY-MM-DD" string).

Optional: Detail (true/false). Defaults to false.

@client.get_summary(start_date: Date.today - 1.week, end_date: Date.today, detail: true)

Session

Get the user's sessions within a period.

Required: Start Date and End Date (Date object or "YYYY-MM-DD" string).

@client.get_sessions(start_date: Date.today - 1.week, end_date: Date.today)

Get a specific session.

Required: ID.

@client.get_session(id: "12345")

Sleep

Get the user's sleeps within a period.

Required: Start Date and End Date (Date object or "YYYY-MM-DD" string).

@client.get_sleeps(start_date: Date.today - 1.week, end_date: Date.today)

Get a specific sleep.

Required: ID.

@client.get_sleep(id: "12345")

Disclaimer

I am not employed by Misfit. This gem was created to help ruby developers build applications on top of misfit.com's data.