Skip to content

Commit da2362a

Browse files
committed
Cleanup code.
1 parent efec72b commit da2362a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Classes/JSONAPIResourceParser.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ + (void)set:(NSObject <JSONAPIResource> *)resource withDictionary:dictionary {
180180

181181
NSDictionary *relationships = [dictionary objectForKey:@"relationships"];
182182
NSDictionary *attributes = [dictionary objectForKey:@"attributes"];
183+
NSDictionary *links = [dictionary objectForKey:@"links"];
183184

184185
id ID = [dictionary objectForKey:@"id"];
185186
NSFormatter *format = [descriptor idFormatter];
@@ -192,11 +193,9 @@ + (void)set:(NSObject <JSONAPIResource> *)resource withDictionary:dictionary {
192193
[resource setValue:ID forKey:[descriptor idProperty]];
193194
}
194195

195-
if (dictionary[@"links"]) {
196-
if (descriptor.selfLinkProperty) {
197-
NSString *selfLink = dictionary[@"links"][@"self"];
198-
[resource setValue:selfLink forKey:descriptor.selfLinkProperty];
199-
}
196+
if (descriptor.selfLinkProperty) {
197+
NSString *selfLink = links[@"self"];
198+
[resource setValue:selfLink forKey:descriptor.selfLinkProperty];
200199
}
201200

202201
// Loops through all keys to map to properties

0 commit comments

Comments
 (0)