Last active
May 6, 2016 23:59
-
-
Save ProbablePrime/2f1bd5c8140ce9ad8df8037244e38d65 to your computer and use it in GitHub Desktop.
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 characters
var WsabiClient = require('wsabi-client-bacon'); | |
var wsabi = new WsabiClient('https://beam.pro'); | |
wsabi.liveUrl = '/api/v1/live'; | |
wsabi.socket.on('open', doIt); | |
function login(username, password) { | |
console.log('login'); | |
return wsabi.post('/api/v1/users/login', {username, password}); | |
} | |
function postData() { | |
var jsonString = 'YOUR JSON HERE ON ONE LINE YAY'; | |
var json = JSON.parse(jsonString); | |
console.log('post'); | |
return wsabi.put('/api/v1/tetris/versions/' + <version id here>, json ); | |
} | |
function doIt() { | |
login('ProbablePrime', '<password>').then(postData).then(function () { | |
console.log('done'); | |
}).catch(function (err) { | |
console.log(err); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment