hipchatter
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -20,2 +20,12 @@ // Endpoints | ||
// Get capabilities | ||
// https://www.hipchat.com/docs/apiv2/method/get_capabilities | ||
capabilities: function(callback) { | ||
// Make a request without an auth token, since only unauthorized users are allowed to call this resource | ||
this.request('get', 'capabilities', {'token': ''}, function(err, results){ | ||
if(err) callback(err); | ||
else callback(err, results); | ||
}); | ||
}, | ||
// Create a new room | ||
@@ -273,3 +283,4 @@ // https://www.hipchat.com/docs/apiv2/method/create_room | ||
} else if (arguments.length === 4) { // with payload | ||
needle.get(this.url(path, payload), requestCallback); | ||
var url = (payload.hasOwnProperty('token'))? this.url(path, payload, payload.token) : this.url(path, payload); | ||
needle.get(url, requestCallback); | ||
} | ||
@@ -276,0 +287,0 @@ |
{ | ||
"name": "hipchatter", | ||
"description": "Wrapper for the HipChat API (v2)", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"author": "Charlton Roberts <charltonroberts@gmail.com (http://charlton.io)", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -50,2 +50,18 @@ HipChatter | ||
### hipchatter.capabilities | ||
Returns the capabilities descriptor for HipChat. | ||
**Parameters:** None | ||
**Results:** | ||
- `err`, error object if the request failed, null otherwise | ||
- `capabilities`, an object containing the capabilities of the HipChat API | ||
#### Usage | ||
````javascript | ||
hipchatter.capabilities(function(err, capabilities){ | ||
console.log(capabilities); | ||
}); | ||
```` | ||
### hipchatter.rooms | ||
@@ -321,3 +337,3 @@ Returns all of the rooms you have access to. | ||
---- | ||
- Capabilities | ||
- ~~Capabilities~~ | ||
- Emoticons | ||
@@ -324,0 +340,0 @@ - ~~Get all emoticons~~ |
@@ -68,2 +68,23 @@ var assert = require("assert"); | ||
// Get capabilities | ||
describe('Get capabilities', function(){ | ||
var err, capabilities; | ||
// Make the request | ||
before(function(done){ | ||
hipchatter.capabilities(function(_err, _capabilities){ | ||
err = _err; | ||
capabilities = _capabilities; | ||
done(); | ||
}); | ||
}); | ||
it('should not return an error', function(){ | ||
expect(err).to.be.null; | ||
}); | ||
it('should return capabilities', function(){ | ||
expect(capabilities).to.have.property('capabilities'); | ||
}); | ||
}); | ||
// Create a new room | ||
@@ -70,0 +91,0 @@ describe('Create room', function(){ |
62043
825
377