-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetLocations.m
35 lines (29 loc) · 1021 Bytes
/
GetLocations.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
//
// GetLocations.m
// AvocadoTest1
//
// Created by Christophe Biocca on 12-01-27.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "GetLocations.h"
#import "APICallProtectedMethods.h"
#import "Location.h"
@implementation GetLocations
@synthesize locations;
+(void)getLocationsForRestaurant:(NSInteger)restaurant success:(void(^)(id))success failure:(void(^)(id,NSError*))failure{
[self sendGETRequestForLocation:[NSString stringWithFormat:@"customer/locations/%d/", restaurant]
success:success
failure:failure];
}
-(void)postCompletionHook{
[super postCompletionHook];
if(![self error]){
NSMutableArray* locationsList = [NSMutableArray array];
for(NSDictionary* locDict in [[self jsonData] objectForKey:@"locations"]){
Location* location = [[Location alloc] initFromData:locDict];
[locationsList addObject:location];
}
locations = locationsList;
}
}
@end