Comparing version 1.6.0 to 1.7.0
10
index.js
@@ -32,2 +32,12 @@ /** | ||
//allow environment vars to override config vals | ||
if(process.env.STRAVA_ACCESS_TOKEN) | ||
util.config.access_token = process.env.STRAVA_ACCESS_TOKEN; | ||
if(process.env.STRAVA_CLIENT_SECRET) | ||
util.config.client_secret = process.env.STRAVA_CLIENT_SECRET; | ||
if(process.env.STRAVA_CLIENT_ID) | ||
util.config.client_id = process.env.STRAVA_CLIENT_ID; | ||
if(process.env.STRAVA_REDIRECT_URI) | ||
util.config.redirect_uri = process.env.STRAVA_REDIRECT_URI; | ||
//assign various api segments to strava object | ||
@@ -34,0 +44,0 @@ strava.oauth = oauth; |
@@ -98,3 +98,3 @@ /** | ||
//stringify the body object for passage | ||
var qs = querystring.stringify(args.body); | ||
//var qs = querystring.stringify(args.body); | ||
@@ -106,3 +106,3 @@ var url = this.endpointBase + endpoint | ||
, json: true | ||
, body: qs | ||
, body: args.body | ||
, headers: { | ||
@@ -109,0 +109,0 @@ Authorization: 'Bearer ' + args.access_token |
{ | ||
"name": "strava-v3", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "Simple wrapper for strava v3 api", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,3 +15,3 @@ | ||
###Status | ||
### Status | ||
Supports API functionality for all API endpoints from `oauth` to `uploads`: | ||
@@ -36,3 +36,3 @@ | ||
##Quick start | ||
## Quick start | ||
@@ -58,12 +58,31 @@ * Create an application at [strava.com/developers](http://www.strava.com/developers) and make note of your `access_token` | ||
## Resources | ||
##Resources | ||
* [Strava Developers Center](http://www.strava.com/developers) | ||
* [Strava API Reference](http://strava.github.io/api/) | ||
##Usage | ||
## Usage | ||
###General | ||
### Config and Environment Variables | ||
The template `strava_config` file can be found at the modules root directory and has the following structure | ||
```json | ||
{ | ||
"access_token" :"Your apps access token (Required for Quickstart)" | ||
, "client_id" :"Your apps Client ID (Required for oauth)" | ||
, "client_secret" :"Your apps Client Secret (Required for oauth)" | ||
, "redirect_uri" :"Your apps Authorization Redirection URI (Required for oauth)" | ||
} | ||
``` | ||
You may alternatively supply the values via environment variables named following the convention `STRAVA_<keyName>`, so | ||
- `STRAVA_ACCESS_TOKEN` = `access_token` | ||
- `STRAVA_CLIENT_ID` = `client_id` | ||
- `STRAVA_CLIENT_SECRET` = `client_secret` | ||
- `STRAVA_REDIRECT_URI` = `redirect_uri` | ||
### General | ||
API access is designed to be as closely similar in layout as possible to Strava's own architecture, | ||
@@ -86,3 +105,3 @@ with the general call definition being | ||
###Overriding the default `access_token` | ||
### Overriding the default `access_token` | ||
@@ -102,3 +121,3 @@ You'll probably want to do this with every call once your app is in production, using an `access_token` specific to a validated user allows for detailed athlete information, as well as the option for additional `PUT`/`POST`/`DELETE` privileges. | ||
###Dealing with pagination | ||
### Dealing with pagination | ||
@@ -119,3 +138,3 @@ For those API calls that support pagination, you can control both the `page` being retrieved and the number of responses to return `per_page` by adding the corresponding properties to `args`. | ||
###Uploading files | ||
### Uploading files | ||
To upload a file you'll have to pass in the `data_type` as specified in Strava's API reference as well as a string `file` designating the `<filepath>/<filename>`. If you want to get updates on the status of your upload pass in `statusCallback` along with the rest of your `args` - the wrapper will check on the upload once a second until complete. | ||
@@ -139,3 +158,3 @@ | ||
###Supported API Endpoints | ||
### Supported API Endpoints | ||
@@ -204,3 +223,3 @@ Oauth: | ||
##Development | ||
## Development | ||
@@ -210,3 +229,3 @@ This package includes a full test suite runnable via `grunt jshint simplemocha` or `npm test`, | ||
###Running the tests | ||
### Running the tests | ||
@@ -230,3 +249,3 @@ You'll first need to supply `data/strava_config` with an `access_token` that has both private read and write permissions: | ||
###How the tests work | ||
### How the tests work | ||
@@ -233,0 +252,0 @@ Using the provided `access_token` tests will access each endpoint individually: |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59955
1544
247
10
1