Skip to content

Instantly share code, notes, and snippets.

@thomasdegry
Created June 21, 2013 12:37
Show Gist options
  • Save thomasdegry/5830880 to your computer and use it in GitHub Desktop.
Save thomasdegry/5830880 to your computer and use it in GitHub Desktop.
- (void)setPaidOnServer
{
[KGStatusBar showWithStatus: @"Validating your order"];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://student.howest.be"]];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"GET"
path:[NSString stringWithFormat:@"thomas.degry/20122013/MAIV/FOOD/api/creations/pay/%@/%@", self.userID, self.burgerID]
parameters:nil];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[httpClient registerHTTPOperationClass:[AFHTTPRequestOperation class]];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
// Print the response body in text
NSLog(@"Response: %@", [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]);
[KGStatusBar dismiss];
[self delete];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
[operation start];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment