Skip to content
This repository has been archived by the owner on Jan 16, 2018. It is now read-only.

LRRestyResource post:callback method fix #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Classes/LRRestyResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ typedef void (^LRRestyResourceResponseBlock)(LRRestyResponse *response, LRRestyR
- (LRRestyRequest *)get:(LRRestyResourceResponseBlock)responseBlock;
- (void)post:(LRRestyResourceResponseBlock)responseBlock;
- (void)post:(id)payload callback:(LRRestyResourceResponseBlock)responseBlock;
-(void)put:(id)payload callback:(LRRestyResourceResponseBlock)responseBlock;
@end

@interface LRRestyResource (Streaming)
Expand Down
11 changes: 10 additions & 1 deletion Classes/LRRestyResource.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,21 @@ - (void)post:(LRRestyResourceResponseBlock)responseBlock;
- (void)post:(id)payload callback:(LRRestyResourceResponseBlock)responseBlock;
{
__block LRRestyResource *blockResource = [self retain];
[restClient put:[URL absoluteString] payload:payload headers:nil withBlock:^(LRRestyResponse *response){
[restClient post:[URL absoluteString] payload:payload headers:nil withBlock:^(LRRestyResponse *response){
responseBlock(response, blockResource);
[blockResource release];
}];
}

- (void)put:(id)payload callback:(LRRestyResourceResponseBlock)responseBlock;
{
__block LRRestyResource *blockResource = [self retain];
[restClient put:[URL absoluteString] payload:payload headers:nil withBlock:^(LRRestyResponse *response){
responseBlock(response, blockResource);
[blockResource release];
}];
}

// forward other methods to the client

- (id)forwardingTargetForSelector:(SEL)aSelector
Expand Down