Created
March 3, 2017 07:17
Revisions
-
findchris created this gist
Mar 3, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ diff --git a/node_modules/robin-js-sdk/lib/api/modules/spaces.js b/node_modules/robin-js-sdk/lib/api/modules/spaces.js index c2cac7a..96d9886 100644 --- a/node_modules/robin-js-sdk/lib/api/modules/spaces.js +++ b/node_modules/robin-js-sdk/lib/api/modules/spaces.js @@ -54,6 +54,28 @@ module.exports = { }, /** + * Space Events + * @type {Object} + */ + events: { + /** + * Create an event for a space + * @param {String|Integer} spaceIdentifier A Robin space identifier + * @param {Object} data A data object + * @return {Function} A Promise + */ + create: function(spaceIdentifier, data) { + var path; + if (spaceIdentifier && data) { + path = this.constructPath(constants.SPACES, spaceIdentifier, constants.EVENTS); + return this.Core.POST(path, data); + } else { + return this.rejectRequest('Bad Request: A space identifier and event data are required'); + } + } + }, + + /** * Space Devices * @type {Object} */