Skip to content

A small iOs library to make easy connect to a REST webservice

License

Notifications You must be signed in to change notification settings

greengrowapps/GGRest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GGRest

CI Status codecov.io Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Example

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];

Installation

GGRest is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "GGRest"

License

GGRest is available under the Apache License Version 2.0. See the LICENSE file for more info.

About

A small iOs library to make easy connect to a REST webservice

Resources

License

Stars

Watchers

Forks

Packages

No packages published