Skip to content

MeatCubeLabel/node-storenvy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-storenvy v0.4.1

NPM version Build Status Code Climate Test Coverage Inline docs

A Node wrapper to the Storenvy API

Supports OAuth 2 authentication.

Changes in v0.4.0

  • All endpoints implemented
  • Fully unit tested suite
  • New build process

Roadmap

  • Simplify API
  • Major refactor
  • Add more examples (express)
  • Write better documentation

Getting Started

Download node-storenvy via npm

npm install storenvy

Add the storenvy module to your project:

var Storenvy = require('storenvy');

Public API Calls

To make public API calls, create a new Storenvy object:

var storenvy = new Storenvy();

On the created storenvy object, use the methods on the public property to make public API calls to Storenvy. *This does not require any authentication. Example:

storenvy.public.getStoreInfo('meatcube', function(err, data) {
	console.log(data);
});

Authenticated API Calls

Authenticated calls are a little trickier. You will need to sign up for a developer account with Storenvy to get an Application ID and Application Secret. Sign up here: https://developers.storenvy.com

Create a new Storenvy object with your credentials:

var creds = {
	appId: '<YOUR_APPLICATION_ID>',
	appSecret: '<YOUR_APPLICATION_SECRET>',
	redirect: '<YOUR_APP_REDIRECT_URL>'
};

var storenvy = new Storenvy(creds);

With the Storenvy object, you need to generate a client using an access_token from Storenvy. This follows the OAauth 2 pattern (specific details here: https://developers.storenvy.com/authentication). To generate the initial URL for a user to authenticate from, with all permissions:

storenvy.buildOAuthURL(true, true);

Storenvy will redirect that request to your registered redirect URL with a code query parameter. Once you have that code, you can generate a newly authenticated Client:

storenvy.generateClient(code, function(err, client) {
	//store or call using your new client
});

The authenticated Client has many types of store data that it can get. Here is an example of one such call:

client.getStoreInfo(function(err, data) {
	console.log(data);
});

More documentation is coming soon!

About

A Node client to access the Storenvy API

Resources

License

Stars

Watchers

Forks

Packages

No packages published