Skip to content
This repository has been archived by the owner on May 4, 2023. It is now read-only.

Bdbergeron master #5

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion BreweryDB/BDBBeer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#import <Foundation/Foundation.h>

@class BDBStyle;

#pragma mark -
@interface BDBBeer : NSObject
Expand All @@ -37,7 +38,7 @@
@property (nonatomic) NSNumber *glasswareId;
@property (nonatomic) NSDictionary *glass;
@property (nonatomic) NSNumber *styleId;
@property (nonatomic) NSDictionary *style;
@property (nonatomic) BDBStyle *style;
@property (nonatomic, assign, getter = isOrganic) BOOL organic;
@property (nonatomic) NSDictionary *labels;
@property (nonatomic) NSNumber *servingTemperature;
Expand Down
1 change: 1 addition & 0 deletions BreweryDB/BDBBrewery.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@property (nonatomic, copy) NSString *mailingListURL;
@property (nonatomic, assign, getter = isOrganic) BOOL organic;
@property (nonatomic) NSDictionary *images;
@property (nonatomic) NSArray *locations;

@property (nonatomic, copy, readonly) NSString *status;

Expand Down
12 changes: 12 additions & 0 deletions BreweryDB/BDBBrewery.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import "BDBBrewery.h"
#import "BDBLocation.h"


#pragma mark -
Expand All @@ -46,6 +47,17 @@ - (id)initWithDictionary:(NSDictionary *)dictionary
_organic = [dictionary[NSStringFromSelector(@selector(isOrganic))] boolValue];
_images = dictionary[NSStringFromSelector(@selector(images))];

NSMutableArray *mutableLocations = [NSMutableArray array];
for (NSDictionary *locationDictionary in dictionary[NSStringFromSelector(@selector(locations))])
{
BDBLocation *location = [[BDBLocation alloc] initWithDictionary:locationDictionary];
if (location)
[mutableLocations addObject:location];
else
NSLog(@"Could not parse location: %@", location);
}
_locations = mutableLocations;

_status = dictionary[NSStringFromSelector(@selector(status))];
}
@catch (NSException *exception)
Expand Down
37 changes: 37 additions & 0 deletions BreweryDB/BDBCategory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// BDBCategory.h
//
// Copyright (c) 2013 Bradley David Bergeron
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import <Foundation/Foundation.h>


#pragma mark -
@interface BDBCategory : NSObject

@property (nonatomic, copy, readonly) NSString *categoryId;
@property (nonatomic) NSNumber *createDate;
@property (nonatomic, copy) NSString *name;

@property (nonatomic, copy, readonly) NSString *status;

- (id)initWithDictionary:(NSDictionary *)dictionary;

@end
55 changes: 55 additions & 0 deletions BreweryDB/BDBCategory.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// BDBCategory.m
//
// Copyright (c) 2013 Bradley David Bergeron
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import "BDBCategory.h"


#pragma mark -
@implementation BDBCategory

- (id)initWithDictionary:(NSDictionary *)dictionary
{
self = [super init];
if (!self)
return nil;

if (!dictionary)
return self;

@try
{
_categoryId = dictionary[@"id"];
_createDate = dictionary[NSStringFromSelector(@selector(createDate))];
_name = dictionary[NSStringFromSelector(@selector(name))];

_status = dictionary[NSStringFromSelector(@selector(status))];
}
@catch (NSException *exception)
{
NSLog(@"Could not parse category: %@", exception);
return nil;
}

return self;
}

@end
53 changes: 53 additions & 0 deletions BreweryDB/BDBFermentable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// BDBFermentable.h
//
// Copyright (c) 2013 Bradley David Bergeron
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import <Foundation/Foundation.h>

#pragma mark -
@interface BDBFermentable : NSObject

@property (nonatomic, copy, readonly) NSString *fermentableId;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *descriptionString;
@property (nonatomic, copy) NSString *countryOfOrigin;
@property (nonatomic) NSNumber *srmId;
@property (nonatomic) NSNumber *srmPrecise;
@property (nonatomic) NSDictionary *srm;
@property (nonatomic) NSNumber *moistureContent;
@property (nonatomic) NSNumber *coarseFineDifference;
@property (nonatomic) NSNumber *diastaticPower;
@property (nonatomic) NSNumber *dryYield;
@property (nonatomic) NSNumber *potential;
@property (nonatomic) NSNumber *protein;
@property (nonatomic) NSNumber *solubleNitrogenRatio;
@property (nonatomic) NSNumber *maxInBatch;
@property (nonatomic, assign, getter = requiresMashing) BOOL mashing;
@property (nonatomic, copy) NSString *category;
@property (nonatomic, copy) NSString *categoryDisplay;
@property (nonatomic) NSDictionary *country;
@property (nonatomic) NSDictionary *characteristics;

@property (nonatomic, copy, readonly) NSString *status;

- (id)initWithDictionary:(NSDictionary *)dictionary;

@end
72 changes: 72 additions & 0 deletions BreweryDB/BDBFermentable.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//
// BDBFermentable.m
//
// Copyright (c) 2013 Bradley David Bergeron
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import "BDBFermentable.h"

#pragma mark -
@implementation BDBFermentable

- (id)initWithDictionary:(NSDictionary *)dictionary
{
self = [super init];
if (!self)
return nil;

if (!dictionary)
return self;

@try
{
_fermentableId = dictionary[@"id"];
_name = dictionary[NSStringFromSelector(@selector(name))];
_descriptionString = [dictionary[@"description"] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

_countryOfOrigin = dictionary[NSStringFromSelector(@selector(countryOfOrigin))];
_srmId = dictionary[NSStringFromSelector(@selector(srmId))];
_srmPrecise = dictionary[NSStringFromSelector(@selector(srmPrecise))];
_srm = dictionary[NSStringFromSelector(@selector(srm))];
_moistureContent = dictionary[NSStringFromSelector(@selector(moistureContent))];
_coarseFineDifference = dictionary[NSStringFromSelector(@selector(coarseFineDifference))];
_diastaticPower = dictionary[NSStringFromSelector(@selector(diastaticPower))];
_dryYield = dictionary[NSStringFromSelector(@selector(dryYield))];
_potential = dictionary[NSStringFromSelector(@selector(potential))];
_protein = dictionary[NSStringFromSelector(@selector(protein))];
_solubleNitrogenRatio = dictionary[NSStringFromSelector(@selector(solubleNitrogenRatio))];
_maxInBatch = dictionary[NSStringFromSelector(@selector(maxInBatch))];
_mashing = [dictionary[NSStringFromSelector(@selector(requiresMashing))] boolValue];
_category = dictionary[NSStringFromSelector(@selector(category))];
_categoryDisplay = dictionary[NSStringFromSelector(@selector(categoryDisplay))];
_country = dictionary[NSStringFromSelector(@selector(country))];
_characteristics = dictionary[NSStringFromSelector(@selector(characteristics))];

_status = dictionary[NSStringFromSelector(@selector(status))];
}
@catch (NSException *exception)
{
NSLog(@"Could not parse beer: %@", exception);
return nil;
}

return self;
}

@end
59 changes: 59 additions & 0 deletions BreweryDB/BDBHop.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// BDBHop.h
//
// Copyright (c) 2013 Bradley David Bergeron
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import <Foundation/Foundation.h>

#pragma mark -
@interface BDBHop : NSObject

@property (nonatomic, copy, readonly) NSString *hopId;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *descriptionString;
@property (nonatomic, copy) NSString *countryOfOrigin;

@property (nonatomic) NSNumber *alphaAcidMin;
@property (nonatomic) NSNumber *alphaAcidMax;
@property (nonatomic) NSNumber *betaAcidMin;
@property (nonatomic) NSNumber *betaAcidMax;
@property (nonatomic) NSNumber *humuleneMin;
@property (nonatomic) NSNumber *humuleneMax;
@property (nonatomic) NSNumber *caryophylleneMin;
@property (nonatomic) NSNumber *caryophylleneMax;
@property (nonatomic) NSNumber *cohumuloneMin;
@property (nonatomic) NSNumber *cohumuloneMax;
@property (nonatomic) NSNumber *myrceneMin;
@property (nonatomic) NSNumber *myrceneMax;
@property (nonatomic) NSNumber *farneseneMin;
@property (nonatomic) NSNumber *farneseneMax;
@property (nonatomic, assign, getter = isNobel) BOOL nobel;
@property (nonatomic, assign, getter = isForBittering) BOOL forBittering;
@property (nonatomic, assign, getter = isForFlavor) BOOL forFlavor;
@property (nonatomic, assign, getter = isForAroma) BOOL forAroma;
@property (nonatomic) NSString *category;
@property (nonatomic) NSString *categoryDisplay;
@property (nonatomic) NSDictionary *country;

@property (nonatomic, copy, readonly) NSString *status;

- (id)initWithDictionary:(NSDictionary *)dictionary;

@end
Loading