GithubHelp home page GithubHelp logo

andrewarrow / misfit_gem Goto Github PK

View Code? Open in Web Editor NEW

This project forked from randomizor/misfit_gem

0.0 3.0 0.0 217 KB

A client library to retrieve data from misfit shine

License: MIT License

Ruby 100.00%

misfit_gem's Introduction

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.

misfit_gem's People

Contributors

faber avatar randomizor avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.