Created
February 8, 2011 21:22
-
-
Save probablycorey/817275 to your computer and use it in GitHub Desktop.
test.lua
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
| waxClass{"User", Base} | |
| -- Class Methods | |
| ---------------- | |
| function login(class, login, password) | |
| class:get{class:url("user/show/%s", login), callback = function(body, response) | |
| puts(body) | |
| end, | |
| authCallback = function(challenge) | |
| if challenge:previousFailureCount() == 0 and not challenge:proposedCredential() then | |
| local credential = NSURLCredential:credentialWithUser_password_persistence(login, password, NSURLCredentialPersistenceNone) | |
| challenge:sender():useCredential_forAuthenticationChallenge(credential, challenge) | |
| else | |
| challenge:sender():continueWithoutCredentialForAuthenticationChallenge(challenge) | |
| end | |
| end} | |
| end | |
| function currentUser(class) | |
| return wax.cache.get("current-user") | |
| end | |
| function setCurrentUser(class, user) | |
| return wax.cache.set("current-user", user) | |
| end | |
| -- Instance Methods | |
| ------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment