Latest 1.0.1
Homepage https://github.com/williamFalcon/WFHttp
License MIT
Platforms ios 7.0, requires ARC
Dependencies Reachability
Authors

Simple, lightweight HTTP class for iOS.

COCOAPODS

pod 'WFHttp'

SAMPLE USE

  1. GET

        [WFHttp GET:@"http://myUrl.com" optionalParameters:nil optionalHTTPHeaders:nil completion:^(id result, NSInteger statusCode, NSHTTPURLResponse *response) {
    
            //do stuff with my results
        }];
  2. POST

        [WFHttp POST:@"http://myUrl.com" optionalHTTPHeaders:nil object:myObject completion:^(id result, NSInteger statusCode, NSHTTPURLResponse *response) {
    
            //do stuff with my results
        }];
  3. PUT (sending an image)

        UIImage *selfie = [...]
        NSDictionary *body = @{@"user_id":[User currentUser].id, @"mySelfie":selfie};
    
        [WFHttp PUT:@"http://myUrl.com" optionalHTTPHeaders:nil form:body completion:^(id result, NSInteger statusCode, NSHTTPURLResponse *response) {
            //do stuff with my results
        }];

METHODS

+(id)sharedWFHttp;

Singleton instance to access manager from anywhere

+(void)GET:(NSString*)url optionalParameters:(NSDictionary *)parameters optionalHTTPHeaders:(NSDictionary *)headers completion:(void(^)(id result, NSInteger statusCode, NSHTTPURLResponse *response))completion

Basic GET request. Results return in the completion block

+(void)POST:(NSString*)url optionalHTTPHeaders:(NSDictionary *)headers object:(id)object completion:(void(^)(id result, NSInteger statusCode, NSHTTPURLResponse *response))completion

Basic POST request. Results return in the completion block.
Object can be anything (array, dictionary, NSObject, and more).

+ (void)PUT:(NSString*)url optionalHTTPHeaders:(NSDictionary *)headers form:(id)form completion:(void(^)(id result, NSInteger statusCode, NSHTTPURLResponse *response))completion

Basic PUT request. Results return in the completion block.
Object is an NSDictionary that represents a form.
Adding an image to the dictionary results in sending the image.
Using id as type to be compatible with swift.

+(void)PUT:(NSString*)url optionalHTTPHeaders:(NSDictionary *)headers object:(id)object completion:(void(^)(id result, NSInteger statusCode, NSHTTPURLResponse *response))completion

Basic PUT request. Results return in the completion block.
Object can be anything (array, dictionary, NSObject, and more).

+(void)POSTToQueue:(NSString *)url object:(id)object

Create a post request but instead of sending immediately, it adds to a queue to be sent after.
the threshold specified.

+(void)sendQueue

Sends all enqueued requests

+(int)postRequestsInQueue

Returns the count of requests waiting to be sent

-(void)purgeQueue

Sends all enqueued requests
Uses a slightly different implementation to support background mode once
app has exited

FEATURES

Http class wired to perform:

  1. GET
  2. POST
  3. Batch POST requests

BUILT IN DEPENDENCIES

Reachability

Latest podspec

{
    "name": "WFHttp",
    "version": "1.0.1",
    "summary": "Basic http class for iOS",
    "homepage": "https://github.com/williamFalcon/WFHttp",
    "license": "MIT",
    "authors": {
        "williamFalcon": "[email protected]"
    },
    "social_media_url": "https://twitter.com/_willfalcon",
    "source": {
        "git": "https://github.com/williamFalcon/WFHttp.git",
        "tag": "v1.0.1"
    },
    "source_files": "WFHttp/**/*.{h,m}",
    "public_header_files": "WFHttp/Public/**/*.{h,m}",
    "requires_arc": true,
    "dependencies": {
        "Reachability": []
    },
    "platforms": {
        "ios": "7.0"
    }
}

Pin It on Pinterest

Share This