File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 16
16
17
17
@property (nonatomic , strong ) NSDictionary *meta;
18
18
@property (nonatomic , strong ) NSDictionary *linked;
19
+ @property (nonatomic , strong ) NSDictionary *links;
19
20
@property (nonatomic , strong ) NSError *error;
20
21
21
22
+ (id )JSONAPIWithString : (NSString *)string ;
Original file line number Diff line number Diff line change @@ -130,6 +130,27 @@ - (void)inflateWithDictionary:(NSDictionary*)dictionary {
130
130
131
131
}
132
132
133
+ // Link mapping / types
134
+ _links = [dictionary objectForKey: @" links" ];
135
+ if (![_links isKindOfClass: [NSDictionary class ]]) {
136
+ _links = nil ;
137
+ }
138
+
139
+ if (_links) {
140
+ for (NSString *key in _links) {
141
+
142
+ NSDictionary *mapping = [_links objectForKey: key];
143
+
144
+ if ([mapping isKindOfClass: [NSDictionary class ]]) {
145
+
146
+ NSString *type = [mapping objectForKey: @" type" ];
147
+ NSString *strippedKey = [[key componentsSeparatedByString: @" ." ] lastObject ];
148
+
149
+ [JSONAPIResourceLinker link: strippedKey toLinkedType: type];
150
+ }
151
+ }
152
+ }
153
+
133
154
_linked = creatingLinked;
134
155
}
135
156
You can’t perform that action at this time.
0 commit comments