woocommerce-api
Advanced tools
Comparing version 1.0.0 to 1.0.1
'use strict'; | ||
var API = require('./woocommerce-api.js'); // use require('WooCommerceAPI') | ||
var WooCommerceAPI = require('./index.js'); // use require('WooCommerceAPI') | ||
// Initialize the WooCommerceAPI class | ||
var WooCommerce = new API({ | ||
var WooCommerce = new WooCommerceAPI({ | ||
url: 'http://example.com', // Your store url (required) | ||
@@ -8,0 +8,0 @@ // version: 'v3', // WooCommerce API version (optional) |
{ | ||
"name": "woocommerce-api", | ||
"description": "A Node.js wrapper for the WooCommerce REST API", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"scripts": { | ||
@@ -21,3 +21,3 @@ "lint": "jshint .", | ||
"license": "MIT", | ||
"main": "woocommerce-api.js", | ||
"main": "index.js", | ||
"dependencies": { | ||
@@ -24,0 +24,0 @@ "oauth-1.0a": "^0.2.1", |
# WooCommerce API - Node.js Client | ||
A Node.js wrapper for the WooCommerce REST API | ||
A Node.js wrapper for the WooCommerce REST API. Easily interact with the WooCommerce REST API using this library. | ||
@@ -14,12 +14,63 @@ [](http://travis-ci.org/woothemes/wc-api-node) | ||
## TODO | ||
## Getting started | ||
- [ ] README - Usage section | ||
- [ ] README - Changelog section | ||
- [ ] tests | ||
Generate API credentials (Consumer Key & Consumer Secret) following this instructions <http://docs.woothemes.com/document/woocommerce-rest-api/> | ||
. | ||
## Usage | ||
Check out the WooCommerce API endpoints and data that can be manipulated in <http://woothemes.github.io/woocommerce-rest-api-docs/>. | ||
## License | ||
## Setup | ||
MIT | ||
```js | ||
var WooCommerceAPI = require('WooCommerceAPI'); | ||
var WooCommerce = new WooCommerceAPI({ | ||
url: 'http://example.com', | ||
consumerKey: 'ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', | ||
consumerSecret: 'cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | ||
}); | ||
``` | ||
### Options | ||
| Option | Type | Required | Description | | ||
| ---------------- | -------- | -------- | --------------------------------------------------------------------------------------------------- | | ||
| `url` | `String` | yes | Your Store URL, example: http://woo.dev/ | | ||
| `consumerKey` | `String` | yes | Your API consumer key | | ||
| `consumerSecret` | `String` | yes | Your API consumer secret | | ||
| `version` | `String` | no | API version, default is `v3` | | ||
| `verifySsl` | `Bool` | no | Verify SSL when connect, use this option as `false` when need to test with self-signed certificates | | ||
| `encoding` | `String` | no | Encoding, default is 'utf-8' | | ||
## Methods | ||
| Params | Type | Description | | ||
| ---------- | ---------- | ------------------------------------------------------------ | | ||
| `endpoint` | `String` | WooCommerce API endpoint, example: `customers` or `order/12` | | ||
| `data` | `Object` | JS object, will be converted to JSON | | ||
| `callback` | `Function` | Callback function. Returns `err`, `data` and `res` | | ||
### GET | ||
- `.get(endpoint)` | ||
- `.get(endpoint, callback)` | ||
### POST | ||
- `.post(endpoint, data)` | ||
- `.post(endpoint, data, callback)` | ||
### PUT | ||
- `.put(endpoint, data)` | ||
- `.put(endpoint, data, callback)` | ||
### DELETE | ||
- `.delete(endpoint)` | ||
- `.delete(endpoint, callback)` | ||
## Release History | ||
- 2015-07-11 - v1.0.1 - Added unit tests, improved the main class and added full description on README.md. | ||
- 2015-07-11 - v1.0.0 - Initial release. |
@@ -1,2 +0,2 @@ | ||
var WooCommerce = require('./woocommerce-api.js'); | ||
var WooCommerce = require('./index.js'); | ||
var chai = require('chai'); | ||
@@ -3,0 +3,0 @@ var nock = require('nock'); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15247
76
1