deskbookers
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -7,2 +7,6 @@ # Change Log | ||
## 1.3.1 - 2017-04-25 | ||
### Fixed | ||
- `POST` request bug | ||
## 1.3.0 - 2017-04-19 | ||
@@ -9,0 +13,0 @@ ### Changed |
@@ -122,6 +122,6 @@ (function (global, factory) { | ||
function Account(api) { | ||
function Account() { | ||
_classCallCheck(this, Account); | ||
return _possibleConstructorReturn(this, (Account.__proto__ || Object.getPrototypeOf(Account)).call(this, api)); | ||
return _possibleConstructorReturn(this, (Account.__proto__ || Object.getPrototypeOf(Account)).apply(this, arguments)); | ||
} | ||
@@ -128,0 +128,0 @@ |
@@ -116,2 +116,3 @@ (function (global, factory) { | ||
case 0: | ||
method = method.toUpperCase(); | ||
options = { | ||
@@ -128,7 +129,7 @@ mode: mode, | ||
}, params); | ||
queryStr = (0, _requests.formatArgs)(args, options.method === 'post'); | ||
queryStr = (0, _requests.formatArgs)(args, options.method === 'POST'); | ||
pathFixed = path.replace(/^\/+|\/+$/, ''); | ||
url = void 0; | ||
if (options.method === 'post') { | ||
if (options.method === 'POST') { | ||
options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'; | ||
@@ -141,23 +142,23 @@ options.body = queryStr; | ||
_context.prev = 6; | ||
_context.next = 9; | ||
_context.prev = 7; | ||
_context.next = 10; | ||
return this.prepareRequest(url, options, args); | ||
case 9: | ||
case 10: | ||
_ref3 = _context.sent; | ||
requestUrl = _ref3.url; | ||
requestOptions = _ref3.options; | ||
_context.next = 14; | ||
_context.next = 15; | ||
return fetch(requestUrl, requestOptions); | ||
case 14: | ||
case 15: | ||
response = _context.sent; | ||
return _context.abrupt('return', this.parseResponse(response)); | ||
case 18: | ||
_context.prev = 18; | ||
_context.t0 = _context['catch'](6); | ||
case 19: | ||
_context.prev = 19; | ||
_context.t0 = _context['catch'](7); | ||
return _context.abrupt('return', false); | ||
case 21: | ||
case 22: | ||
case 'end': | ||
@@ -167,3 +168,3 @@ return _context.stop(); | ||
} | ||
}, _callee, this, [[6, 18]]); | ||
}, _callee, this, [[7, 19]]); | ||
})); | ||
@@ -170,0 +171,0 @@ |
{ | ||
"name": "deskbookers", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Deskbookers API JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -55,4 +55,4 @@ import dotenv from 'dotenv' | ||
t.throws(deskbookers.account.retrieve()) | ||
const login = await deskbookers.account.login(LOGIN_EMAIL, LOGIN_PASSWORD) | ||
await deskbookers.account.login(LOGIN_EMAIL, LOGIN_PASSWORD) | ||
t.notThrows(deskbookers.account.retrieve()) | ||
}) |
@@ -17,3 +17,3 @@ import dotenv from 'dotenv' | ||
t.true(deskbookers.cart.available()) | ||
t.true(cart.available()) | ||
@@ -43,5 +43,5 @@ // TODO: test more | ||
} catch (e) { | ||
t.fail(`Error while preparing cart: ${e && e.message || 'Exception occurred'}`) | ||
t.fail(`Error while preparing cart: ${(e && e.message) || 'Exception occurred'}`) | ||
return deskbookers.cart | ||
} | ||
} |
@@ -5,6 +5,4 @@ import dotenv from 'dotenv' | ||
import Deskbookers from '../src' | ||
import moment from 'moment' | ||
dotenv.load() | ||
// Shopping cart | ||
@@ -11,0 +9,0 @@ test('Initialise', async t => { |
@@ -22,3 +22,3 @@ import dotenv from 'dotenv' | ||
{ type: 'visitors', start, end }, | ||
{ type: 'visitors', city: 'amsterdam', start, end }, | ||
{ type: 'visitors', city: 'amsterdam', start, end } | ||
] | ||
@@ -25,0 +25,0 @@ |
213123