deskbookers
Advanced tools
Comparing version 5.7.1 to 5.8.0
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['module', 'exports', './Resource', '../errors'], factory); | ||
define(['module', 'exports', './Resource'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(module, exports, require('./Resource'), require('../errors')); | ||
factory(module, exports, require('./Resource')); | ||
} else { | ||
@@ -10,6 +10,6 @@ var mod = { | ||
}; | ||
factory(mod, mod.exports, global.Resource, global.errors); | ||
factory(mod, mod.exports, global.Resource); | ||
global.Bookings = mod.exports; | ||
} | ||
})(this, function (module, exports, _Resource2, _errors) { | ||
})(this, function (module, exports, _Resource2) { | ||
'use strict'; | ||
@@ -109,6 +109,6 @@ | ||
function Bookings(api) { | ||
function Bookings() { | ||
_classCallCheck(this, Bookings); | ||
return _possibleConstructorReturn(this, (Bookings.__proto__ || Object.getPrototypeOf(Bookings)).call(this, api)); | ||
return _possibleConstructorReturn(this, (Bookings.__proto__ || Object.getPrototypeOf(Bookings)).apply(this, arguments)); | ||
} | ||
@@ -115,0 +115,0 @@ |
@@ -70,2 +70,3 @@ (function (global, factory) { | ||
// Create sub-resources | ||
@@ -72,0 +73,0 @@ _this.users = new _Users2.default(api); |
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['module', 'exports', './Resource', '../errors', 'lodash/get'], factory); | ||
define(['module', 'exports', './Resource', '../errors', 'lodash/get', 'lodash/isNil'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(module, exports, require('./Resource'), require('../errors'), require('lodash/get')); | ||
factory(module, exports, require('./Resource'), require('../errors'), require('lodash/get'), require('lodash/isNil')); | ||
} else { | ||
@@ -10,6 +10,6 @@ var mod = { | ||
}; | ||
factory(mod, mod.exports, global.Resource, global.errors, global.get); | ||
factory(mod, mod.exports, global.Resource, global.errors, global.get, global.isNil); | ||
global.Search = mod.exports; | ||
} | ||
})(this, function (module, exports, _Resource2, _errors, _get) { | ||
})(this, function (module, exports, _Resource2, _errors, _get, _isNil) { | ||
'use strict'; | ||
@@ -25,2 +25,4 @@ | ||
var _isNil2 = _interopRequireDefault(_isNil); | ||
function _interopRequireDefault(obj) { | ||
@@ -174,2 +176,54 @@ return obj && obj.__esModule ? obj : { | ||
}() | ||
}, { | ||
key: 'spaceSuggestions', | ||
value: function () { | ||
var _ref2 = _asyncToGenerator(regeneratorRuntime.mark(function _callee2() { | ||
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
text = _ref3.text, | ||
context = _ref3.context, | ||
language = _ref3.language, | ||
_ref3$resolveBounds = _ref3.resolveBounds, | ||
resolveBounds = _ref3$resolveBounds === undefined ? false : _ref3$resolveBounds; | ||
var params; | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
params = { | ||
q: text || '', | ||
resolveBounds: resolveBounds | ||
}; | ||
if (!(0, _isNil2.default)(context)) { | ||
params.context = context; | ||
} | ||
if (!(0, _isNil2.default)(language)) { | ||
params.language = language; | ||
} | ||
_context2.next = 5; | ||
return this.request({ | ||
method: 'GET', | ||
path: '/spaces/suggestions', | ||
params: params | ||
}); | ||
case 5: | ||
return _context2.abrupt('return', _context2.sent); | ||
case 6: | ||
case 'end': | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2, this); | ||
})); | ||
function spaceSuggestions() { | ||
return _ref2.apply(this, arguments); | ||
} | ||
return spaceSuggestions; | ||
}() | ||
}]); | ||
@@ -176,0 +230,0 @@ |
@@ -268,2 +268,30 @@ (function (global, factory) { | ||
}() | ||
}, { | ||
key: 'suggestions', | ||
value: function () { | ||
var _ref5 = _asyncToGenerator(regeneratorRuntime.mark(function _callee5(params) { | ||
return regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
while (1) { | ||
switch (_context5.prev = _context5.next) { | ||
case 0: | ||
_context5.next = 2; | ||
return this.api.search.spaceSuggestions(params); | ||
case 2: | ||
return _context5.abrupt('return', _context5.sent); | ||
case 3: | ||
case 'end': | ||
return _context5.stop(); | ||
} | ||
} | ||
}, _callee5, this); | ||
})); | ||
function suggestions(_x6) { | ||
return _ref5.apply(this, arguments); | ||
} | ||
return suggestions; | ||
}() | ||
}]); | ||
@@ -270,0 +298,0 @@ |
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['module', 'exports', './Resource', '../errors'], factory); | ||
define(['module', 'exports', './Resource'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(module, exports, require('./Resource'), require('../errors')); | ||
factory(module, exports, require('./Resource')); | ||
} else { | ||
@@ -10,6 +10,6 @@ var mod = { | ||
}; | ||
factory(mod, mod.exports, global.Resource, global.errors); | ||
factory(mod, mod.exports, global.Resource); | ||
global.Venues = mod.exports; | ||
} | ||
})(this, function (module, exports, _Resource2, _errors) { | ||
})(this, function (module, exports, _Resource2) { | ||
'use strict'; | ||
@@ -16,0 +16,0 @@ |
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['exports', 'hash.js', 'url', 'qs', 'json_encode', 'deskbookers-phpurlencode', 'lodash/includes', 'lodash/isEmpty'], factory); | ||
define(['exports', 'hash.js', 'url', 'qs', 'json_encode', 'deskbookers-phpurlencode', 'lodash/includes'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require('hash.js'), require('url'), require('qs'), require('json_encode'), require('deskbookers-phpurlencode'), require('lodash/includes'), require('lodash/isEmpty')); | ||
factory(exports, require('hash.js'), require('url'), require('qs'), require('json_encode'), require('deskbookers-phpurlencode'), require('lodash/includes')); | ||
} else { | ||
@@ -10,6 +10,6 @@ var mod = { | ||
}; | ||
factory(mod.exports, global.hash, global.url, global.qs, global.json_encode, global.deskbookersPhpurlencode, global.includes, global.isEmpty); | ||
factory(mod.exports, global.hash, global.url, global.qs, global.json_encode, global.deskbookersPhpurlencode, global.includes); | ||
global.requests = mod.exports; | ||
} | ||
})(this, function (exports, _hash, _url, _qs, _json_encode, _deskbookersPhpurlencode, _includes, _isEmpty) { | ||
})(this, function (exports, _hash, _url, _qs, _json_encode, _deskbookersPhpurlencode, _includes) { | ||
'use strict'; | ||
@@ -28,4 +28,2 @@ | ||
var _isEmpty2 = _interopRequireDefault(_isEmpty); | ||
function _interopRequireDefault(obj) { | ||
@@ -32,0 +30,0 @@ return obj && obj.__esModule ? obj : { |
{ | ||
"name": "deskbookers", | ||
"version": "5.7.1", | ||
"version": "5.8.0", | ||
"description": "Deskbookers API JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -7,4 +7,2 @@ import dotenv from 'dotenv' | ||
import util from 'util' | ||
dotenv.load() | ||
@@ -26,3 +24,3 @@ | ||
const deskbookers = await client(true) | ||
const date = moment().subtract(2, 'months').calendar(); | ||
const date = moment().subtract(2, 'months').calendar() | ||
@@ -29,0 +27,0 @@ let booking = await deskbookers.bookings.month(date, 12686) |
@@ -76,3 +76,3 @@ import dotenv from 'dotenv' | ||
const data = await deskbookers.features.create( | ||
{name: 'testName', description: 'teste description', type: 'venue'} | ||
{ name: 'testName', description: 'teste description', type: 'venue' } | ||
) | ||
@@ -86,6 +86,6 @@ t.truthy(data) | ||
t.truthy(deskbookers.session) | ||
const data = await deskbookers.features.update( | ||
'testName', | ||
{name: 'testName', description: 'teste description 2', type: 'venue2', parentId: null} | ||
{ name: 'testName', description: 'teste description 2', type: 'venue2', parentId: null } | ||
) | ||
@@ -109,3 +109,3 @@ t.truthy(data) | ||
let start = new Date().setDate(new Date().getDate()-20) | ||
let start = new Date().setDate(new Date().getDate() - 20) | ||
let end = null | ||
@@ -133,2 +133,2 @@ const data = await deskbookers.features.updateFeatureByVenue( | ||
t.truthy(data) | ||
}) | ||
}) |
@@ -116,3 +116,3 @@ import dotenv from 'dotenv' | ||
context: 'c12345', | ||
meta:'{"clientName": "Chompers", "companyName": "Lambda3"}', | ||
meta: '{"clientName": "Chompers", "companyName": "Lambda3"}', | ||
createdDate: 1498653156259 | ||
@@ -134,3 +134,3 @@ } | ||
context: 'c12345', | ||
meta:'{"clientName": "Chompers", "companyName": "Lambda3"}', | ||
meta: '{"clientName": "Chompers", "companyName": "Lambda3"}', | ||
createdDate: 1498653156259 | ||
@@ -145,3 +145,3 @@ } | ||
context: 'c12345', | ||
meta:'{"clientName": "Chompers", "companyName": "Lambda3"}', | ||
meta: '{"clientName": "Chompers", "companyName": "Lambda3"}', | ||
createdDate: 1496925186484 | ||
@@ -158,3 +158,3 @@ } | ||
const data = await deskbookers.notifications.flagAsRead({userId: 2, id: 1}) | ||
const data = await deskbookers.notifications.flagAsRead({ userId: 2, id: 1 }) | ||
t.truthy(data) | ||
@@ -168,3 +168,3 @@ }) | ||
const data = await deskbookers.notifications.flagAsRead({userId: 2, type: 'fluffycorgi'}) | ||
const data = await deskbookers.notifications.flagAsRead({ userId: 2, type: 'fluffycorgi' }) | ||
t.truthy(data) | ||
@@ -178,3 +178,3 @@ }) | ||
const data = await deskbookers.notifications.flagAsRead({userId:3}) | ||
const data = await deskbookers.notifications.flagAsRead({ userId: 3 }) | ||
t.truthy(data) | ||
@@ -181,0 +181,0 @@ }) |
@@ -36,71 +36,2 @@ | ||
test('payments invoices list', async t => { | ||
// Prepare API | ||
const deskbookers = await client(true) | ||
t.truthy(deskbookers.session) | ||
const data = await deskbookers.payments.invoices.list({}) | ||
t.truthy(data) | ||
}) | ||
test('payments invoices get', async t => { | ||
// Prepare API | ||
const deskbookers = await client(true) | ||
t.truthy(deskbookers.session) | ||
const data = await deskbookers.payments.invoices.get( | ||
{invoiceId: 'in_1AqhEsGAwNnYLy52Ces9TQVZ'} | ||
) | ||
t.truthy(data) | ||
}) | ||
test('payments plans list', async t => { | ||
// Prepare API | ||
const deskbookers = await client(true) | ||
t.truthy(deskbookers.session) | ||
const data = await deskbookers.payments.plans.list({}) | ||
t.truthy(data) | ||
}) | ||
test('payments plan', async t => { | ||
// Prepare API | ||
const deskbookers = await client(true) | ||
t.truthy(deskbookers.session) | ||
const data = await deskbookers.payments.plans.get( | ||
{planId: 'bookingTool-9900-1x-month-0-eur'} | ||
) | ||
t.truthy(data) | ||
}) | ||
test('payments subscriptions plan', async t => { | ||
// Prepare API | ||
const deskbookers = await client(true) | ||
t.truthy(deskbookers.session) | ||
const data = await deskbookers.payments.plans.subscriptions( | ||
{planId: 'bookingTool-9900-1x-month-0-eur'} | ||
) | ||
t.truthy(data) | ||
}) | ||
test('payments subscriptions list', async t => { | ||
// Prepare API | ||
const deskbookers = await client(true) | ||
t.truthy(deskbookers.session) | ||
const data = await deskbookers.payments.subscriptions.list({limit: 1, status: 'active'}) | ||
t.truthy(data) | ||
}) | ||
test('payments get subscription', async t => { | ||
// Prepare API | ||
const deskbookers = await client(true) | ||
t.truthy(deskbookers.session) | ||
const data = await deskbookers.payments.subscriptions.get({subscriptionId: 'sub_BD7TzpiYW9PSlz'}) | ||
t.truthy(data) | ||
}) | ||
test('payments user', async t => { | ||
@@ -107,0 +38,0 @@ // Prepare API |
@@ -23,2 +23,2 @@ import test from 'ava' | ||
t.is(testString, convertedString) | ||
}) | ||
}) |
@@ -7,2 +7,5 @@ import dotenv from 'dotenv' | ||
const TYPE_GOOGLE_MAPS = 'GOOGLE_MAPS' | ||
const TYPE_SEARCH_RESULT = 'SEARCH_RESULT' | ||
const { | ||
@@ -72,1 +75,42 @@ API_SEARCH_HOST, | ||
}) | ||
test('space suggestions without resolveBounds', async t => { | ||
// Prepare API | ||
const deskbookers = await client() | ||
const result = await deskbookers.search.spaceSuggestions({ | ||
text: 'Amsterdam', | ||
resolveBounds: false | ||
}) | ||
// Test results | ||
t.truthy(Array.isArray(result)) | ||
t.is(result.filter( | ||
hit => hit.type === TYPE_GOOGLE_MAPS && hit.northEast | ||
).length, 0) | ||
t.is(result.filter( | ||
hit => !(hit.formatted && hit.id && isValidType(hit.type)) | ||
).length, 0) | ||
}) | ||
test('space suggestions with resolveBounds', async t => { | ||
// Prepare API | ||
const deskbookers = await client() | ||
const result = await deskbookers.search.spaceSuggestions({ | ||
text: 'Amsterdam', | ||
resolveBounds: true | ||
}) | ||
// Test results | ||
t.truthy(Array.isArray(result)) | ||
t.is(result.filter( | ||
hit => hit.type === TYPE_GOOGLE_MAPS && !hit.northEast | ||
).length, 0) | ||
t.is(result.filter( | ||
hit => !(hit.formatted && hit.id && isValidType(hit.type)) | ||
).length, 0) | ||
}) | ||
const isValidType = type => | ||
[TYPE_GOOGLE_MAPS, TYPE_SEARCH_RESULT].includes(type) |
@@ -34,3 +34,3 @@ import dotenv from 'dotenv' | ||
let payment = { | ||
const payment = { | ||
name: 'aaa222', | ||
@@ -57,2 +57,27 @@ bankInfo: 'NL01BANK012345222', | ||
t.truthy(saved) | ||
t.is(paymentSettings.address.place, payment.address.place) | ||
const payment2 = { | ||
name: 'aaa222', | ||
bankInfo: 'NL01BANK012345222', | ||
bic: 'ABCDEF22', | ||
tax: '1234222', | ||
company: 'hockerson2', | ||
debtor: '1234522', | ||
mark: 'rarara22', | ||
address: | ||
{ country: 'The Netherlands', | ||
addressLine1: 'a2', | ||
postalcode: '2222AK', | ||
place: 'lolala3', | ||
telephonenumber: '+31610512222', | ||
telephonenumber2: '+31123412222', | ||
email: 'e2@e2.c2' | ||
} | ||
} | ||
const saved2 = await deskbookers.venues.savePaymentSettings(11710, payment2) | ||
const paymentSettings2 = await deskbookers.venues.getPaymentSettings(11710) | ||
t.truthy(saved2) | ||
t.is(paymentSettings2.address.place, payment2.address.place) | ||
}) | ||
@@ -59,0 +84,0 @@ |
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
380700
6245