Created
December 10, 2014 18:13
-
-
Save marshallbrekka/e5cb25d6e6c99dcb8dff 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
// Sample data used when put into a mocking mode | |
var exampleAccounts = [{ | |
id: 1, | |
balance: 2254.86, | |
name: "JetBlue Card Orig" | |
}]; | |
var accounts = new PersistentSpec("accounts/1/accounts", { | |
seq : true, | |
// proxy functions are called in place of network requests when in | |
// mocking mode | |
proxy : { | |
get : function(opts, promise) { | |
promise.resolve({"_control" : {result : "ok"}, response : proxyAccounts}); | |
} | |
} | |
}); | |
// Sample Usage | |
API.get(accounts, {id : 10}, function(serverResponse) { | |
if (serverResponse[0].id === 10) { | |
console.log("We have an account with id 10, just like we asked for"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment