2015-07-23 18:03:19 +08:00

40 lines
1021 B
Objective-C

#import "SWGOrder.h"
@implementation SWGOrder
/**
* Maps json key to property name.
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
}
/**
* Indicates whether the property with the given name is optional.
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
* This method is used by `JSONModel`.
*/
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
NSArray *optionalProperties = @[@"_id", @"petId", @"quantity", @"shipDate", @"status", @"complete"];
if ([optionalProperties containsObject:propertyName]) {
return YES;
}
else {
return NO;
}
}
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end