Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sharing Support

  • Loading branch information...
commit 1b0de0a005edaab3fe92802926cb5acc4f55d1ab 1 parent 2d45ada
@bencevans authored
Showing with 76 additions and 8 deletions.
  1. +60 −8 README.md
  2. +16 −0 lib/nodeGauges.js
View
68 README.md
@@ -2,12 +2,12 @@
NodeJS API wrapper for [Guag.es](http://gaug.es).
-#Development Status
+<b>All API Calls Methods Supported</b>
-<b>Implemented</b>
* Your Information
* API Clients
* Gauges
+* Sharing
* Content
* Referrers
* Traffic
@@ -17,12 +17,6 @@ NodeJS API wrapper for [Guag.es](http://gaug.es).
* Search Engines
* Locations
-<b>Not Implemented</b>
-
-* Sharing <- I Don't have a Gauge.es account that allows sharing, if you wish to use this then either write it yourself and submit a pull request or contact me and I'll implement it for you to test.
-
-
-
#Installation
@@ -239,6 +233,64 @@ nodeGauges.gauges.delete('GAUGE_ID', function (err, data) {
}
});
```
+####List Shares (GET /gauges/:id/shares) - [Gaug.es Docs](http://get.gaug.es/documentation/reference-listing/sharing/#list-shares)
+
+```javascript
+nodeGauges.sharing(gaugeID, callback);
+```
+
+* gaugeID (string) - Gauge Identifier
+* callback (function) - Returns API Data in the format callback(err, data, responce);
+
+```javascript
+nodeGauges.sharing('GAUGE_ID', function (err, data) {
+ if(err){
+ console.log('Error: ' + err);
+ } else{
+ console.log(data);
+ }
+});
+```
+
+####Share Gauge (POST /gauges/:id/shares) - [Gaug.es Docs](http://get.gaug.es/documentation/reference-listing/sharing/#share-gauge)
+
+```javascript
+nodeGauges.sharing.share(gaugeID, email, callback);
+```
+
+* gaugeID (string) - Gauge Identifier
+* email (string) - Email of the person you wish to share the gauge with
+* callback (function) - Returns API Data in the format callback(err, data, responce);
+
+```javascript
+nodeGauges.sharing.share('GAUGE_ID', 'bob@example.com', function (err, data) {
+ if(err){
+ console.log('Error: ' + err);
+ } else{
+ console.log(data);
+ }
+});
+```
+
+####UnShare Gauge (DELETE /gauges/:id/shares/:user_id) - [Gaug.es Docs](http://get.gaug.es/documentation/reference-listing/sharing/#unshare-gauge)
+
+```javascript
+nodeGauges.sharing.unshare(gaugeID, userID, callback);
+```
+
+* gaugeID (string) - Gauge Identifier
+* userID (string) - This can be found by using the nodeGauges.sharing method.
+* callback (function) - Returns API Data in the format callback(err, data, responce);
+
+```javascript
+nodeGauges.sharing.unshare('GAUGE_ID', 'USERID', function (err, data) {
+ if(err){
+ console.log('Error: ' + err);
+ } else{
+ console.log(data);
+ }
+});
+```
####Content (GET /gauges/:id/content) - [Gaug.es Docs](http://get.gaug.es/documentation/reference-listing/content/#content)
View
16 lib/nodeGauges.js
@@ -67,6 +67,22 @@ function nodeGaugesClient (apiKey) {
nodeGauges.apiCall('/gauges/' + gaugeID, 'DELETE', {}, callback);
}
+ this.sharing = function (gaugeID, callback) {
+ nodeGauges.apiCall('/gauges/' + gaugeID + '/shares', 'GET', {}, callback);
+ }
+
+ this.sharing.share = function (gaugeID, email, callback) {
+ nodeGauges.apiCall('/gauges/' + gaugeID + '/shares', 'POST', {
+ email:email
+ }, callback);
+ }
+
+ this.sharing.unshare = function (gaugeID, userID, callback) {
+ nodeGauges.apiCall('/gauges/' + gaugeID + '/shares/' + userID, 'DELETE', {
+ email:email
+ }, callback);
+ }
+
this.content = function (gaugeID, var1, var2) {
if(typeof var2 == 'undefined'){
Please sign in to comment.
Something went wrong with that request. Please try again.