Skip to content

randomizor/misfit_gem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A client library to retrieve data from misfit shine

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages