A client library to retrieve data from misfit shine
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
Gemfile.lock
Guardfile
LICENSE
README.md
Rakefile
changelog.md
misfit_gem.gemspec

README.md

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.