Skip to content

Commit d2ef04c

Browse files
Merge pull request #31 from cloudspace/67859548_update_model_comments
67859548 update model comments
2 parents cb43f47 + 8266809 commit d2ef04c

6 files changed

Lines changed: 138 additions & 17 deletions

File tree

EasyReader.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,14 +578,14 @@
578578
9DAC171D170A043200383722 /* Models */ = {
579579
isa = PBXGroup;
580580
children = (
581+
8E7F81EE18D0BF8500BC50C2 /* CSBaseObject.h */,
582+
8E7F81EF18D0BF8500BC50C2 /* CSBaseObject.m */,
581583
0DE51FF618CF919900454E51 /* Feed.h */,
582584
0DE51FF718CF919900454E51 /* Feed.m */,
583585
0DE51FEF18CF911000454E51 /* FeedItem.h */,
584586
0DE51FF018CF911000454E51 /* FeedItem.m */,
585587
0DE51FF118CF911000454E51 /* User.h */,
586588
0DE51FF218CF911000454E51 /* User.m */,
587-
8E7F81EE18D0BF8500BC50C2 /* CSBaseObject.h */,
588-
8E7F81EF18D0BF8500BC50C2 /* CSBaseObject.m */,
589589
);
590590
path = Models;
591591
sourceTree = "<group>";

EasyReader/Application/Models/CSBaseObject.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,23 @@
1111
#import "NSObject+CSNilAdditions.h"
1212
#import "NSString+Inflections.h"
1313

14+
15+
#pragma mark - CSBaseObject -
16+
17+
/**
18+
* A base for NSManagedObjects that represent objects in a remote API object
19+
*/
1420
@interface CSBaseObject : NSManagedObject
21+
22+
23+
#pragma mark - Instance creation from API Data helpers
24+
25+
/*
26+
* Creates or updates an object base on API data
27+
*
28+
* @param remoteObjectData the api data to update/create based on
29+
*/
1530
+ (id)createOrUpdateFirstFromAPIData:(NSDictionary *)remoteObjectData;
1631

32+
1733
@end

EasyReader/Application/Models/Feed.h

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,78 @@
1212

1313
@class FeedItem, User;
1414

15+
16+
#pragma mark - Feed -
17+
18+
/**
19+
* An RSS Feed
20+
*/
1521
@interface Feed : CSBaseObject
1622

23+
24+
#pragma mark - Core Data Properties
25+
26+
/// This feed's icon
1727
@property (nonatomic, retain) NSString * icon;
28+
29+
/// This feed's name
1830
@property (nonatomic, retain) NSString * name;
31+
32+
/// This feed's RSS url
1933
@property (nonatomic, retain) NSString * url;
34+
35+
/// The remote ID of this feed object on the API
2036
@property (nonatomic, retain) NSNumber * id;
37+
38+
/// The user this feed is associated to
2139
@property (nonatomic, retain) User *user;
40+
41+
/// The items in this feed
2242
@property (nonatomic, retain) NSSet *feedItems;
23-
@end
2443

25-
@interface Feed (CoreDataGeneratedAccessors)
2644

27-
- (void)addFeedItemsObject:(FeedItem *)value;
28-
- (void)removeFeedItemsObject:(FeedItem *)value;
29-
- (void)addFeedItems:(NSSet *)values;
30-
- (void)removeFeedItems:(NSSet *)values;
45+
#pragma mark - API Methods
3146

47+
/**
48+
* Creates a new feed based on a given url
49+
*
50+
* @param url
51+
* @param successBlock A block to be run on API call success
52+
* @param failureBlock A block to be run on API call failure
53+
*/
3254
+ (void) createFeedWithUrl:(NSString *) url
3355
success:(void(^)(NSDictionary *data))successBlock
3456
failure:(void(^)(NSDictionary *data))failureBlock;
3557

58+
/**
59+
* Requests the default feeds list (called once on the first app run)
60+
*
61+
* @param successBlock A block to be run on API call success
62+
* @param failureBlock A block to be run on API call failure
63+
*/
3664
+ (void) requestDefaultFeedsWithSuccess:(void(^)(NSDictionary *data))successBlock
3765
failure:(void(^)(NSDictionary *data))failureBlock;
3866

67+
/**
68+
* Requests a list of feeds by name (search)
69+
*
70+
* @param successBlock A block to be run on API call success
71+
* @param failureBlock A block to be run on API call failure
72+
*/
3973
+ (void) requestFeedsByName:(NSString *) name
4074
success:(void(^)(NSDictionary *data))successBlock
4175
failure:(void(^)(NSDictionary *data))failureBlock;
4276

4377
@end
78+
79+
80+
#pragma mark - Core Data Generated Accessors -
81+
82+
@interface Feed (CoreDataGeneratedAccessors)
83+
84+
- (void)addFeedItemsObject:(FeedItem *)value;
85+
- (void)removeFeedItemsObject:(FeedItem *)value;
86+
- (void)addFeedItems:(NSSet *)values;
87+
- (void)removeFeedItems:(NSSet *)values;
88+
89+
@end

EasyReader/Application/Models/FeedItem.h

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,65 @@
1212

1313
@class Feed;
1414

15+
16+
#pragma mark - FeedItem -
17+
18+
/**
19+
* A single feed item in a feed
20+
*/
1521
@interface FeedItem : CSBaseObject
1622

23+
24+
#pragma mark - Core Data Properties
25+
26+
/// The article title for this feed item
1727
@property (nonatomic, retain) NSString * title;
28+
29+
/// The summary for this feed item
1830
@property (nonatomic, retain) NSString * summary;
31+
32+
/// The time this feed item was updated
1933
@property (nonatomic, retain) NSDate * updatedAt;
34+
35+
/// The time this feed item's article was published
2036
@property (nonatomic, retain) NSDate * publishedAt;
37+
38+
/// The time this feed item was created
2139
@property (nonatomic, retain) NSDate * createdAt;
40+
41+
/// The image for this feed item
2242
@property (nonatomic, retain) NSString * image;
43+
44+
/// The article URL for this feed item
2345
@property (nonatomic, retain) NSString * url;
46+
47+
/// This feed items remote API id
2448
@property (nonatomic, retain) NSNumber * id;
49+
50+
/// The feed this item is in
2551
@property (nonatomic, retain) Feed *feed;
2652

27-
- (NSString *)headline;
2853

54+
#pragma mark - Properties
55+
56+
/// The appropriate headline for this article
57+
@property (readonly) NSString *headline;
58+
59+
60+
#pragma mark - API methods
61+
62+
/**
63+
* Requests new feed items from a group of feeds
64+
*
65+
* @param feeds
66+
* @param startAt
67+
* @param success A block to be run on API call success
68+
* @param failure A block to be run on API call failure
69+
*/
2970
+ (void) requestFeedItemsFromFeeds:(NSSet *)feeds
3071
Since:(NSDate *)startAt
3172
success:(void(^)(NSDictionary *data))successBlock
3273
failure:(void(^)(NSDictionary *data))failureBlock;
3374

75+
3476
@end

EasyReader/Application/Models/FeedItem.m

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,11 @@ - (NSString *)feedName
3434
return feed.name;
3535
}
3636

37-
- (NSString *)timeAgo
38-
{
39-
return [self.updatedAt timeAgo];
40-
}
41-
4237
- (NSString *)headline
4338
{
44-
return[NSString stringWithFormat:@"%@ \u00b7 %@",[self feedName],[self timeAgo]];
39+
NSString *timeAgo = [self.updatedAt timeAgo];
40+
41+
return[NSString stringWithFormat:@"%@ \u00b7 %@", self.feed.name, timeAgo];
4542
}
4643

4744
+ (void) requestFeedItemsFromFeeds:(NSSet *)feeds

EasyReader/Application/Models/User.h

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,38 @@
1212

1313
@class Feed;
1414

15+
#pragma mark - User -
16+
17+
/**
18+
* An EasyReader User generally one per project
19+
*/
1520
@interface User : CSBaseObject
1621

22+
23+
#pragma mark - Core Data Properties
24+
25+
/// The users feeds
1726
@property (nonatomic, retain) NSSet *feeds;
27+
28+
29+
#pragma mark - Methods
30+
31+
/**
32+
* Gets the current user (a singleton shared user)
33+
*/
34+
+ (User *)current;
35+
36+
1837
@end
1938

39+
40+
#pragma mark - Core Data Generated Accessors -
41+
2042
@interface User (CoreDataGeneratedAccessors)
2143

2244
- (void)addFeedsObject:(Feed *)value;
2345
- (void)removeFeedsObject:(Feed *)value;
2446
- (void)addFeeds:(NSSet *)values;
2547
- (void)removeFeeds:(NSSet *)values;
2648

27-
+ (User *)current;
28-
2949
@end

0 commit comments

Comments
 (0)