added entry and film model
This commit is contained in:
24
FestivalHelper/schedule/FESSCheduleEntry.h
Normal file
24
FestivalHelper/schedule/FESSCheduleEntry.h
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// FESSCheduleEntry.h
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 31/08/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class FESScheduleFilm;
|
||||
|
||||
@interface FESSCheduleEntry : NSObject
|
||||
|
||||
-(id)initWithJSONData:(NSDictionary*)data;
|
||||
|
||||
@property (assign) NSInteger scheduleEntryId;
|
||||
@property (strong) NSString *scheduleDayOfWeek;
|
||||
@property (strong) NSString *scheduleDate;
|
||||
@property (strong) NSString *scheduleYear;
|
||||
@property (strong) NSMutableArray *scheduleFilms;
|
||||
|
||||
|
||||
@end
|
||||
43
FestivalHelper/schedule/FESSCheduleEntry.m
Normal file
43
FestivalHelper/schedule/FESSCheduleEntry.m
Normal file
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// FESSCheduleEntry.m
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 31/08/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FESSCheduleEntry.h"
|
||||
#import "FESScheduleFilm.h"
|
||||
|
||||
@implementation FESSCheduleEntry
|
||||
|
||||
@synthesize scheduleEntryId;
|
||||
@synthesize scheduleDate;
|
||||
@synthesize scheduleDayOfWeek;
|
||||
@synthesize scheduleYear;
|
||||
@synthesize scheduleFilms;
|
||||
|
||||
|
||||
-(id)initWithJSONData:(NSDictionary*)data{
|
||||
self = [super init];
|
||||
if(self){
|
||||
//NSLog(@"initWithJSONData method called");
|
||||
self.scheduleEntryId = [[data objectForKey:@"id"] integerValue];
|
||||
self.scheduleDate = [data objectForKey:@"date"];
|
||||
self.scheduleDayOfWeek = [data objectForKey:@"dayOfWeek"];
|
||||
self.scheduleYear = [data objectForKey:@"year"];
|
||||
self.scheduleFilms = [self extractFilms:[data objectForKey:@"films"]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(NSMutableArray *)extractFilms:(NSArray *)films {
|
||||
NSMutableArray *result = [[NSMutableArray alloc] initWithCapacity:[films count]];
|
||||
for (NSDictionary *filmData in films) {
|
||||
FESScheduleFilm *film = [[FESScheduleFilm alloc] initWithJSONData:filmData];
|
||||
[result addObject:film];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
21
FestivalHelper/schedule/FESScheduleFilm.h
Normal file
21
FestivalHelper/schedule/FESScheduleFilm.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// FESScheduleFilm.h
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 31/08/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface FESScheduleFilm : NSObject
|
||||
|
||||
@property (assign) NSInteger scheduleFilmId;
|
||||
@property (strong) NSString *scheduleFilmTitle;
|
||||
@property (strong) NSString *scheduleFilmVenue;
|
||||
@property (strong) NSString *scheduleFilmTime;
|
||||
@property (strong) NSString *scheduleFilmDuration;
|
||||
|
||||
-(id)initWithJSONData:(NSDictionary*)data;
|
||||
|
||||
@end
|
||||
32
FestivalHelper/schedule/FESScheduleFilm.m
Normal file
32
FestivalHelper/schedule/FESScheduleFilm.m
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// FESScheduleFilm.m
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 31/08/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FESScheduleFilm.h"
|
||||
|
||||
@implementation FESScheduleFilm
|
||||
|
||||
@synthesize scheduleFilmId;
|
||||
@synthesize scheduleFilmDuration;
|
||||
@synthesize scheduleFilmTime;
|
||||
@synthesize scheduleFilmTitle;
|
||||
@synthesize scheduleFilmVenue;
|
||||
|
||||
-(id)initWithJSONData:(NSDictionary*)filmData{
|
||||
self = [super init];
|
||||
if(self){
|
||||
//NSLog(@"initWithJSONData method called");
|
||||
self.scheduleFilmId = [[filmData objectForKey:@"id"] integerValue];
|
||||
self.scheduleFilmTitle = [filmData objectForKey:@"title"];
|
||||
self.scheduleFilmVenue = [filmData objectForKey:@"venue"];
|
||||
self.scheduleFilmTime = [filmData objectForKey:@"time"];
|
||||
self.scheduleFilmDuration = [filmData objectForKey:@"duration"];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user