@brunofuster

www.wesaveapp.com

Archive for the ‘mac’ Category

restfulie-objectivec simple post, http response codes and basic auth

with one comment

Now restfulie-objectivec is using by default ASIHTTP. Its too coupled by now, but I’m working on this and you will be able to extend it and use any http lib.

You can now call a simple http post method, without a payload. I’m working on the JSON marshaller and it will be ready soon.


Response *response = [[[client at:@"http://localhost:8888/login"] authUser:@"login" andPassword:@"passwd"] post];

if (response.code == 200) {
    NSLog(@"login success");
} else {
    NSLog(@"login fail");
}

Advertisements

Written by brunofuster

January 16, 2011 at 5:45 pm

Restfulie Objective-C startup

leave a comment »

Restfulie-ObjectiveC development has begun. We’re open for ObjC developers who might be interested to collaborate!

By now you can call HTTP Get methods and marshall JSON responses into objects.

For instance, a custom RestClient can be created using Restfulie’s class method customWithTypes:andCollectionNames:


id<RestClient> client = [Restfulie customWithTypes:[NSArray arrayWithObjects:[User class], nil]
                                andCollectionNames:[NSArray arrayWithObjects:@"users", nil]];

Response *response = [[client at:@"http://localhost:8888/users"] get];
NSArray *users = [response resource];

//or a simple user

Response *response = [[client at:@"http://localhost:8888/users/1"] get];
User *user = [response resource];

I’m refactoring the entire project to design it as closer as possible to other Restfulie’s client implementations, so it might change a lot.
If you’d like to collaborate, send me an email: brunofuster@gmail.com

I will keep you posted through this blog explaining the lastest changes and the features that are being implemented at the moment.

https://github.com/caelum/restfulie-objectivec

Written by brunofuster

January 12, 2011 at 12:59 pm