To run the example project, clone the repo, and run pod install
from the Example directory first.
This example gets the content of the url using basic http auth and deserializes the content as an object:
GGWs *ws=[[GGWs alloc] init];
ws.url=@"https://api.github.com/repos/greengrowapps/GGRest/commits";
ws.method=GET;
ws.authentication=[[GGHttpBasicAuth alloc] initWithUsername:@"YOUR_GITHUB_USER" andPassword:@"YOUR_GITHUB_PASSWD"];
ws.onOkArray=^(NSArray *commitsList ,GGGitCommit *nill ){
for(GGGitCommit *c in commitsList){
NSLog(@"Commit: %@",c);
}
};
ws.onError=^(GGHttpResponse *response,NSError *error){
NSLog(@"Unknown error");
};
[ws onResponse:404 objectCallBack:^(GGHttpResponse *res){
NSLog(@"Repo not found");
}];
[ws onResponse:401 objectCallBack:^(GGHttpResponse *res){
NSLog(@"Invalid credentials");
}];
[ws execute];
GGRest is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "GGRest"
GGRest is available under the Apache License Version 2.0. See the LICENSE file for more info.