Skip to content

Instantly share code, notes, and snippets.

@aaronksaunders
Created October 28, 2011 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aaronksaunders/1321510 to your computer and use it in GitHub Desktop.
Save aaronksaunders/1321510 to your computer and use it in GitHub Desktop.
example app using appcelerator stackmob module
//
// APPCELERATOR - STACKMOB IOS MODULE
//
// aaron@clearlyinnovative.com
// 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: "aaron2@clearlyinnovative.com"
},
function(d) {
Ti.API.info(JSON.stringify(d))
});
// ============================================================
// USER LOGIN
stackmob.login("aaron2@clearlyinnovative.com", "--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