-
-
Save srhyne/1331734 to your computer and use it in GitHub Desktop.
example app using appcelerator stackmob module
This file contains 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
// | |
// APPCELERATOR - STACKMOB IOS MODULE | |
// | |
// [email protected] | |
// blog.clearlyinnovative.com | |
// | |
// http://stackmob.com | |
// | |
var window = Ti.UI.createWindow({ | |
backgroundColor: 'white' | |
}); | |
var label = Ti.UI.createLabel(); | |
window.add(label); | |
window.open(); | |
// TODO: write your module tests here | |
var stackmob = require('clearlyinnovative.stackmob'); | |
Ti.API.info("module is => " + stackmob); | |
stackmob.init_manager(function(e) { | |
// ============================================================ | |
// UPLOAD PHOTO FOR USER | |
var f = Ti.Filesystem.getFile("yellow.png"); | |
stackmob.doPostQuery("photo", { | |
data: f.read() | |
}, | |
function(d) { | |
if ( d.success ) { | |
Ti.API.info("doPostQuery " + JSON.stringify(d)); | |
} else { | |
Ti.API.error("doPostQuery ERROR" + JSON.stringify(d)); | |
} | |
}); | |
// ============================================================ | |
// GET A USER by USERNAME FIELD | |
stackmob.doGetQuery("user", { | |
username: "[email protected]" | |
}, | |
function(d) { | |
Ti.API.info(JSON.stringify(d)) | |
}); | |
// ============================================================ | |
// USER LOGIN | |
stackmob.login("[email protected]", "--THE PASSWORD--", function(d) { | |
Ti.API.info(JSON.stringify(d)) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment