Skip to content

Instantly share code, notes, and snippets.

@findchris
Created March 3, 2017 07:17

Revisions

  1. findchris created this gist Mar 3, 2017.
    33 changes: 33 additions & 0 deletions space.js
    Original 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}
    */