coinbase-commerce
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -7,2 +7,6 @@ # Change Log | ||
## [1.0.2](https://github.com/AndrewBarba/coinbase-commerce/releases/tag/1.0.2) | ||
1. Fix issue with post body | ||
## [1.0.1](https://github.com/AndrewBarba/coinbase-commerce/releases/tag/1.0.1) | ||
@@ -9,0 +13,0 @@ |
{ | ||
"name": "coinbase-commerce", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Node library for commerce.coinbase.com", | ||
@@ -5,0 +5,0 @@ "author": "Andrew Barba <abarba.77@gmail.com>", |
# Coinbase Commerce | ||
[![npm version](https://badge.fury.io/js/coinbase-commerce.svg)](https://badge.fury.io/js/coinbase-commerce) | ||
[![wercker status](https://app.wercker.com/status/994eb933a3d4130e70dd47eed4788568/s/master "wercker status")](https://app.wercker.com/project/byKey/994eb933a3d4130e70dd47eed4788568) | ||
Node.js library for [commerce.coinbase.com](https://commerce.coinbase.com) | ||
@@ -4,0 +7,0 @@ |
@@ -14,3 +14,3 @@ const axios = require('axios') | ||
*/ | ||
constructor({ apiKey, version = '2018-05-20' }) { | ||
constructor({ apiKey, version = '2018-03-22' }) { | ||
if (!apiKey) throw new Error('apiKey is required') | ||
@@ -76,7 +76,7 @@ | ||
return { | ||
get: id => this._get(`/${name}/${id}`), | ||
list: params => this._get(`/${name}`, { params }), | ||
create: data => this._post(`/${name}`, { data }), | ||
update: (id, data) => this._put(`/${name}/${id}`, { data }), | ||
delete: (id, params) => this._delete(`/${name}/${id}`, { params }) | ||
get: id => this._request('get', `/${name}/${id}`), | ||
list: params => this._request('get', `/${name}`, { params }), | ||
create: data => this._request('post', `/${name}`, { data }), | ||
update: (id, data) => this._request('put', `/${name}/${id}`, { data }), | ||
delete: (id, params) => this._request('delete', `/${name}/${id}`, { params }) | ||
} | ||
@@ -92,42 +92,6 @@ } | ||
*/ | ||
_get(url, params = {}) { | ||
return this._client.get(url, { params }) | ||
_request(method, url, { data, params }) { | ||
return this._client.request({ method, url, data, params }) | ||
.then(res => res.data) | ||
} | ||
/** | ||
* @private | ||
* @method _post | ||
* @param {String} url | ||
* @param {Object} [data] | ||
* @return {Promise} | ||
*/ | ||
_post(url, data = {}) { | ||
return this._client.post(url, { data }) | ||
.then(res => res.data) | ||
} | ||
/** | ||
* @private | ||
* @method _put | ||
* @param {String} url | ||
* @param {Object} [data] | ||
* @return {Promise} | ||
*/ | ||
_put(url, data = {}) { | ||
return this._client.put(url, { data }) | ||
.then(res => res.data) | ||
} | ||
/** | ||
* @private | ||
* @method _delete | ||
* @param {String} url | ||
* @param {Object} [params] | ||
* @return {Promise} | ||
*/ | ||
_delete(url, params = {}) { | ||
return this._client.delete(url, { params }) | ||
.then(res => res.data) | ||
} | ||
} | ||
@@ -134,0 +98,0 @@ |
@@ -6,7 +6,7 @@ const { API_KEY } = process.env | ||
let instance | ||
let client | ||
before(() => { | ||
if (!API_KEY) throw new Error('Must run tests with a valid api key') | ||
instance = new CoinbaseCommerce({ apiKey: API_KEY }) | ||
client = new CoinbaseCommerce({ apiKey: API_KEY }) | ||
}) | ||
@@ -16,4 +16,8 @@ | ||
it('should list', () => { | ||
return instance.charges.list() | ||
return client.charges.list() | ||
}) | ||
it('should create a charge', () => { | ||
return client.charges.create({ pricing_type: 'no_price' }) | ||
}) | ||
}) | ||
@@ -23,3 +27,3 @@ | ||
it('should list', () => { | ||
return instance.checkouts.list() | ||
return client.checkouts.list() | ||
}) | ||
@@ -30,5 +34,5 @@ }) | ||
it('should list', () => { | ||
return instance.events.list() | ||
return client.events.list() | ||
}) | ||
}) | ||
}) |
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
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
36363
9
105
147