forked from moredip/Frank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFranklyProtocolHelper.m
40 lines (31 loc) · 1014 Bytes
/
FranklyProtocolHelper.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
//
// Created by pete on 5/20/12.
//
// To change the template use AppCode | Preferences | File Templates.
//
#import "FranklyProtocolHelper.h"
#import "JSON.h"
@implementation FranklyProtocolHelper {
}
+ (NSString *)generateErrorResponseWithReason:(NSString *)reason andDetails:(NSString *)details{
NSDictionary *response = [NSDictionary dictionaryWithObjectsAndKeys:
@"ERROR", @"outcome",
reason, @"reason",
details, @"details",
nil];
return [response JSONRepresentation];
}
+ (NSString *)generateSuccessResponseWithoutResults{
NSDictionary *response = [NSDictionary dictionaryWithObjectsAndKeys:
@"SUCCESS", @"outcome",
nil];
return [response JSONRepresentation];
}
+ (NSString *)generateSuccessResponseWithResults:(NSArray *)results{
NSDictionary *response = [NSDictionary dictionaryWithObjectsAndKeys:
@"SUCCESS", @"outcome",
results, @"results",
nil];
return [response JSONRepresentation];
}
@end