Top Banner
Samosa Documentation Release Alpha Release Balaji Iyer, Sriram Vasudevan Sep 27, 2017
21

Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

Oct 26, 2019

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

Samosa DocumentationRelease Alpha Release

Balaji Iyer, Sriram Vasudevan

Sep 27, 2017

Page 2: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with
Page 3: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

Contents

1 Features 3

2 Samosa Components 5

3 Samosa Bot 7

4 API 9

5 UI 11

6 Contribute 13

7 Support 15

8 License 17

i

Page 4: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

ii

Page 5: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

Samosa Documentation, Release Alpha Release

Samosa helps you build leaderboards for various fitness devices, allowing you to compete with your friends.

Currently it supports:

• Jawbone Up

• Fitbit

Feature revisions could include -

• Garmin Vivofit

• Polar Loop

• Argus Lifetrak

• Nike Plus

Contents 1

Page 6: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

Samosa Documentation, Release Alpha Release

2 Contents

Page 7: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

CHAPTER 1

Features

• Easy to use API

• Support for many popular devices

3

Page 8: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

Samosa Documentation, Release Alpha Release

4 Chapter 1. Features

Page 9: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

CHAPTER 2

Samosa Components

5

Page 10: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

Samosa Documentation, Release Alpha Release

6 Chapter 2. Samosa Components

Page 11: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

CHAPTER 3

Samosa Bot

Samosa bot is resposible for collecting activities and stats from different APIs and storing it in Redis. The bot runsevery 30 mins. (Configurable)

7

Page 12: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

Samosa Documentation, Release Alpha Release

8 Chapter 3. Samosa Bot

Page 13: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

CHAPTER 4

API

1. Add user details to Samosa

Typical details include the type of product they are using, and credentials that would help pull data on user’s behalffrom device provider’s API

POST /user

Content-Type: application/json

{"name" : "Balaji Iyer","device" : {fitbit,vivofit,up,nikeplus,argus},"credentials" : apikey, {username, password}, customer secret}

Example for fitbit:

Content-Type: application/json

{"credentials": {"client_key": "xx"client_secret": "xx","resource_owner_key": "xx","resource_owner_secret": "xx"},

"device": "fitbit","name": "balaji"}

Example for jawbone-up:

Content-Type: application/json

{

9

Page 14: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

Samosa Documentation, Release Alpha Release

"credentials": {"Authorization": "Bearer xx},"device": "jawbone-up","name": "Obul"

}

2. Get leaderboard

GET /leaderboard

[{

"user": "sriram","rank": 1,"data": { "steps":100, "calories": 200, "distance": 2.8 },"rankingmetric": "steps"

},{

"user": "balaji","rank": 2,"data": { "steps":80, "calories": 200, "distance": 2.8 },"rankingmetric": "steps"

}]

By default, users will be ranked by steps, however the default ranking can be changed→˓by passing a 'rankby' parameter.

GET /leaderboard?rankby={steps,calories,distance}

3. Get stats on a specific user

GET /stats?user={username}

{"user": "sriram","rank": 1,"data": { "steps":100, "calories": 200, "distance": 2.8 },"rankingmetric": "steps"

}

10 Chapter 4. API

Page 15: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

CHAPTER 5

UI

Samosa prints a leaderboard by making an AJAX request to the API. Check ui/leaderboard.html for the source.

11

Page 16: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

Samosa Documentation, Release Alpha Release

12 Chapter 5. UI

Page 17: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

CHAPTER 6

Contribute

• Issue Tracker: github.com/balajiiyer/samosa/issues

• Source Code: github.com/balajiiyer/samosa

13

Page 18: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

Samosa Documentation, Release Alpha Release

14 Chapter 6. Contribute

Page 19: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

CHAPTER 7

Support

If you are having issues, please let us know using the github Issue Tracker.

15

Page 20: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

Samosa Documentation, Release Alpha Release

16 Chapter 7. Support

Page 21: Samosa Documentation - Read the Docs · Samosa Documentation, Release Alpha Release Samosa helps you build leaderboards for various fitness devices, allowing you to compete with

CHAPTER 8

License

The project is licensed under the GPL v2 license.

17