summaryrefslogtreecommitdiff
path: root/Juick/Model/Attachment.m
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/Model/Attachment.m')
-rw-r--r--Juick/Model/Attachment.m17
1 files changed, 17 insertions, 0 deletions
diff --git a/Juick/Model/Attachment.m b/Juick/Model/Attachment.m
index a54e462..006b72e 100644
--- a/Juick/Model/Attachment.m
+++ b/Juick/Model/Attachment.m
@@ -10,4 +10,21 @@
@implementation Attachment
++(Attachment *) fromJSON:(NSDictionary *)jsonData {
+ Attachment *attachment = [Attachment new];
+ attachment.url = jsonData[@"url"];
+ attachment.width = jsonData[@"width"];
+ attachment.height = jsonData[@"height"];
+ if (jsonData[@"small"]) {
+ attachment.small = [Attachment fromJSON:jsonData[@"small"]];
+ }
+ if (jsonData[@"medium"]) {
+ attachment.medium = [Attachment fromJSON:jsonData[@"medium"]];
+ }
+ if (jsonData[@"thumbnail"]) {
+ attachment.thumbnail = [Attachment fromJSON:jsonData[@"thumbnail"]];
+ }
+ return attachment;
+}
+
@end