This repository has been archived by the owner on Jan 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
/
LRRestyClient+PUT.m
65 lines (53 loc) · 2.18 KB
/
LRRestyClient+PUT.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// LRRestyClient+PUT.m
// LRResty
//
// Created by Luke Redpath on 05/08/2010.
// Copyright 2010 LJR Software Limited. All rights reserved.
//
#import "LRRestyClient+PUT.h"
#import "LRRestyClientBlockDelegate.h"
#import "LRRestyClientProxyDelegate.h"
#import "LRSynchronousProxy.h"
@implementation LRRestyClient (PUT)
#pragma mark -
#pragma mark Delegate API
- (LRRestyRequest *)put:(NSString *)urlString payload:(id)payload delegate:(id<LRRestyClientResponseDelegate>)delegate;
{
return [self put:urlString payload:payload headers:nil delegate:delegate];
}
- (LRRestyRequest *)put:(NSString *)urlString payload:(id)payload headers:(NSDictionary *)headers delegate:(id<LRRestyClientResponseDelegate>)delegate;
{
return [HTTPClient PUT:[NSURL URLWithString:urlString] payload:payload headers:headers delegate:[LRRestyClientProxyDelegate proxyForClient:self responseDelegate:delegate]];
}
#pragma mark -
#pragma mark Blocks API
- (LRRestyRequest *)put:(NSString *)urlString payload:(id)payload withBlock:(LRRestyResponseBlock)block;
{
return [self put:urlString payload:payload headers:nil withBlock:block];
}
- (LRRestyRequest *)put:(NSString *)urlString payload:(id)payload headers:(NSDictionary *)headers withBlock:(LRRestyResponseBlock)block;
{
return [HTTPClient PUT:[NSURL URLWithString:urlString] payload:payload headers:headers delegate:[LRRestyClientBlockDelegate delegateWithBlock:block]];
}
#pragma mark -
#pragma mark Synchronous API
- (LRRestyResponse *)put:(NSString *)urlString payload:(id)payload;
{
return [self performAsynchronousBlockAndReturnResultWhenReady:^(id *result, NSCondition *condition)
{
[self put:urlString payload:payload withBlock:^(LRRestyResponse *response) {
LRSYNCHRONOUS_PROXY_NOTIFY_CONDITION(result, [response retain], condition);
}];
}];
}
- (LRRestyResponse *)put:(NSString *)urlString payload:(id)payload headers:(NSDictionary *)headers;
{
return [self performAsynchronousBlockAndReturnResultWhenReady:^(id *result, NSCondition *condition)
{
[self put:urlString payload:payload headers:headers withBlock:^(LRRestyResponse *response) {
LRSYNCHRONOUS_PROXY_NOTIFY_CONDITION(result, [response retain], condition);
}];
}];
}
@end