-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
400 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
// | ||
|
||
#import "PLConnection.h" | ||
#import "PLMenuItem.h" | ||
|
||
static NSMutableArray *sharedConnectionList = nil; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// PLMenu.h | ||
// Plate | ||
// | ||
// Created by emileleon on 12/10/13. | ||
// Copyright (c) 2013 Plate SF. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "JSONSerializable.h" | ||
|
||
@interface PLMenu : NSObject <JSONSerializable> | ||
|
||
@property (nonatomic, strong) NSMutableArray *mains; | ||
@property (nonatomic, strong) NSMutableArray *sides; | ||
@property (nonatomic, strong) NSMutableArray *addons; | ||
@property (nonatomic, strong) NSString *location; | ||
@property (nonatomic, strong) NSDate *menuDate; | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// | ||
// PLMenu.m | ||
// Plate | ||
// | ||
// Created by emileleon on 12/10/13. | ||
// Copyright (c) 2013 Plate SF. All rights reserved. | ||
// | ||
|
||
#import "PLMenu.h" | ||
#import "PLMenuItem.h" | ||
|
||
@implementation PLMenu | ||
|
||
@synthesize mains, sides, addons, location, menuDate; | ||
|
||
-(void)readFromJSONDictionary:(NSDictionary *)d | ||
{ | ||
NSDictionary *response = [d objectForKey:@"response"]; | ||
NSDictionary *mainModifiers = [response valueForKeyPath:@"3.modifiers"]; | ||
if (mainModifiers) { | ||
|
||
if (!mains) { | ||
mains = [[NSMutableArray alloc]init]; | ||
} | ||
|
||
for (NSString *key in mainModifiers) { | ||
|
||
NSLog(@"key is %@", key); | ||
NSDictionary *mainModifier = [mainModifiers objectForKey:key]; | ||
NSDictionary *mainItem = [mainModifier objectForKey:@"meta"]; | ||
|
||
PLMenuItem *plmi = [[PLMenuItem alloc] init]; | ||
[plmi setName:[mainModifier objectForKey:@"name"]]; | ||
// ### UNCOMMENT BELOW WHEN META IS WORKING | ||
// [plmi setName:[mainItem objectForKey:@"name"]]; | ||
// [plmi setDescription:[mainItem objectForKey:@"description"]]; | ||
// [plmi setAllergies:[mainItem objectForKey:@"alergies"]]; | ||
// [plmi setIsGlutenFree:[[mainItem objectForKey:@"is_gluten_free"] boolValue]]; | ||
// [plmi setIsVegan:[[mainItem objectForKey:@"is_vegan"] boolValue]]; | ||
// [plmi setIsVegetarian:[[mainItem objectForKey:@"is_vegetarian"] boolValue]]; | ||
|
||
[mains addObject:plmi]; | ||
} | ||
} | ||
|
||
NSDictionary *sideModifiers = [response valueForKeyPath:@"4.modifiers"]; | ||
if (sideModifiers) { | ||
|
||
if (!sides) { | ||
sides = [[NSMutableArray alloc]init]; | ||
} | ||
|
||
for (NSString *key in sideModifiers) { | ||
NSDictionary *sideItem = [sideModifiers objectForKey:key]; | ||
PLMenuItem *plmi = [[PLMenuItem alloc] init]; | ||
[plmi setName:[sideItem objectForKey:@"name"]]; | ||
[sides addObject:plmi]; | ||
} | ||
} | ||
|
||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.