npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-runkeeper

v0.1.4

Published

Downloads

18

Readme

node-runkeeper - Node.js Client for Runkeeper Health Graph API

Author: Mark Soper

A client/wrapper for the Runkeeper Health Graph API: http://developer.runkeeper.com/healthgraph

Installation

  • node-runkeeper isn't on NPM yet, so for now the best way is cloning the respository from Github and making it available to your code
$ git clone [email protected]:/marksoper/node-runkeeper support/runkeeper/
// in your code
require.paths.unshift('support/runkeeper/lib');

Creating a client

Register your application with Runkeeper to get the credentials needed below: http://runkeeper.com/partner/applications


var options = exports.options = {

    // Client ID: 
    // This value is the OAuth 2.0 client ID for your application.  
    client_id : "< client id >",

    // Client Secret:  
    // This value is the OAuth 2.0 shared secret for your application.   
    client_secret : "< client secret >",
    
    // Authorization URL:   
    // This is the URL to which your application should redirect the user in order to authorize access to his or her RunKeeper account.   
    auth_url : "https://runkeeper.com/apps/authorize",

    // Access Token URL:    
    // This is the URL at which your application can convert an authorization code to an access token. 
    access_token_url : "https://runkeeper.com/apps/token",

    // Redirect URI:   
    // This is the URL that RK sends user to after successful auth  
    // URI naming based on Runkeeper convention 
    redirect_uri : "< redirect uri >"

};

var runkeeper = require('./support/runkeeper/lib/runkeeper');

var client = new runkeeper.HealthGraph(options);

Using the client

Using any of the client's API methods assumes that it has a valid access_token. Once the Health Graph API issues your application an authorization code (see here for more information on registering an application with the Health Graph), you can request an access token.

client.getNewToken(authorization_code, function(access_token) {
  client.access_token = access_token;

  // Now you're free to do whatever you'd like with the client.

  // e.g. Get user profile information
  client.profile(function(data) {
    // data returned in JSON with format depending on type of call
    var obj = JSON.parse(data);
});
})

Extending the client

Only a few of basic API calls are currently supported. Adding support for new calls should be easy - just add entries into this dictionary in api.js

// this is from api.js
//
var API = exports.API = {
    "user": {"media_type": "application/vnd.com.runkeeper.User+json",
             "uri": "/user"},
    "profile": {"media_type": "application/vnd.com.runkeeper.Profile+json",
                "uri": "/profile"},
    "settings": {"media_type": "application/vnd.com.runkeeper.Settings+json",
                "uri": "/settings"},
    "fitnessActivityFeed": {"media_type": "application/vnd.com.runkeeper.FitnessActivityFeed+json",
                "uri": "/fitnessActivities"},
    "fitnessActivities": {"media_type": "application/vnd.com.runkeeper.FitnessActivity+json",
                "uri": "/fitnessActivities"},
};