GGRest 0.1.19

GGRest 0.1.19

测试已测试
语言编程语言 Obj-CObjective C
许可证 Apache 2
发布最后发布2016 年 3 月

GreenGrowApps 维护。



GGRest 0.1.19

  • 作者:
  • Adri

用法

要运行示例项目,请克隆仓库,首先从 Example 目录运行 pod install

示例

此示例使用基本 HTTP 身份验证获取 URL 内容,并将内容反序列化为对象

    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 通过 CocoaPods 提供使用。要安装它,只需将以下行添加到 Podfile 中:

pod "GGRest"

许可证

GGRest 在 Apache License Version 2.0 许可下可用。有关更多信息,请参阅 LICENSE 文件。