Merge branch 'master' of https://github.com/mediaburst/hackathon-starter into mediaburst-master

* 'master' of https://github.com/mediaburst/hackathon-starter:
  Update README.md
  Using the newest clockwork npm package
  Removed commentted out lines from clockwork.jade
  Tweak to the clockwork view
  Adding clockwork SMS to the API mix

Conflicts:
	controllers/api.js
	package.json
This commit is contained in:
Sahat Yalkabov
2014-02-27 19:27:11 -05:00
6 changed files with 67 additions and 0 deletions

View File

@ -15,6 +15,7 @@ var Twit = require('twit');
var paypal = require('paypal-rest-sdk');
var twilio = require('twilio')(secrets.twilio.sid, secrets.twilio.token);
var Linkedin = require('node-linkedin')(secrets.linkedin.clientID, secrets.linkedin.clientSecret, secrets.linkedin.callbackURL);
var clockwork = require('clockwork')({key: secrets.clockwork.apiKey});
/**
* GET /api
@ -413,6 +414,38 @@ exports.postTwilio = function(req, res, next) {
});
};
/**
* GET /api/Clockwork
* Clockwork SMS API example.
*/
exports.getClockwork = function(req, res, next) {
res.render('api/clockwork', {
title: 'Clockwork SMS API'
});
};
/**
* POST /api/Clockwork
* Clockwork SMS API example.
* @param telephone
*/
exports.postClockwork = function(req, res, next) {
var message = {
To: req.body.telephone,
From: 'Hackathon',
Content: 'Hello from the Hackathon Starter'
};
clockwork.sendSms(message, function(err, responseData) {
if (err) return next(err.message);
req.flash('success', { msg: 'Text sent to ' + responseData.responses[0].to});
res.redirect('/api/clockwork');
});
};
/**
* GET /api/venmo
* Venmo API example.