Skip to content

JBMessage is simple iOS networking wrapper based on AFNetworking

License

Notifications You must be signed in to change notification settings

josipbernat/JBMessage

Repository files navigation

JBMessage

JBMessage is simple iOS networking wrapper based on AFNetworking. It allows you to simplify your networking code and forces you to rearrange each API call into separate class.

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like JBMessage in your projects.

Podfile

platform :ios, '6.0'
pod 'JBMessage', '~> 1.0'

USAGE

GET Request

    JBMessage *message = [JBMessage messageWithURL:[NSURL URLWithString:@"http://example.com/resources.json"]
                                        parameters:@{@"foo": @"bar"}
                                     responseBlock:^(id responseObject, NSError *error) {
                                         NSLog(@"%@", responseObject);
                                     }];
    message.httpMethod = JBHTTPMethodGET;
    [message send];

POST Request

    JBMessage *message = [JBMessage messageWithURL:[NSURL URLWithString:@"http://example.com/resources.json"]
                                        parameters:@{@"foo": @"bar"}
                                     responseBlock:^(id responseObject, NSError *error) {
                                         NSLog(@"%@", responseObject);
                                     }];
    message.httpMethod = JBHTTPMethodPOST;
    [message send];

PUT Request

    JBMessage *message = [JBMessage messageWithURL:[NSURL URLWithString:@"http://example.com/resources.json"]
                                        parameters:@{@"foo": @"bar"}
                                     responseBlock:^(id responseObject, NSError *error) {
                                         NSLog(@"%@", responseObject);
                                     }];
    message.httpMethod = JBHTTPMethodPUT;
    [message send];

DELETE Request

    JBMessage *message = [JBMessage messageWithURL:[NSURL URLWithString:@"http://example.com/resources.json"]
                                        parameters:@{@"foo": @"bar"}
                                     responseBlock:^(id responseObject, NSError *error) {
                                         NSLog(@"%@", responseObject);
                                     }];
    message.httpMethod = JBHTTPMethodDELETE;
    [message send];

About

JBMessage is simple iOS networking wrapper based on AFNetworking

Resources

License

Stars

Watchers

Forks

Packages

No packages published