Skip to content

Commit

Permalink
Merge pull request #3 from GuoJing/master
Browse files Browse the repository at this point in the history
这是一个正确的model
  • Loading branch information
lincode committed Dec 18, 2012
2 parents 2dcce53 + d157cb3 commit 39f4aef
Showing 1 changed file with 40 additions and 4 deletions.
44 changes: 40 additions & 4 deletions DoubanAPIEngine/DoubanAPIEngine/Sources/Model2/Book/DOUBook.m
Expand Up @@ -47,6 +47,24 @@ - (NSString *)rating {
return [self.dictionary objectForKey:@"rating"];
}

- (NSString *)numRaters {
NSMutableDictionary *dic = [self.dictionary objectForKey:@"rating"];
if (!dic) {
return nil;
} else {
return [dic objectForKey:@"numRaters"];
}
}

- (NSString *)average {
NSMutableDictionary *dic = [self.dictionary objectForKey:@"rating"];
if (!dic) {
return nil;
} else {
return [dic objectForKey:@"average"];
}
}

- (NSString *)ISBN10 {
return [self.dictionary objectForKey:@"isbn10"];
}
Expand All @@ -65,19 +83,37 @@ - (NSDate *)publishDate {
}


- (NSString *)images{
return [self.dictionary objectForKey:@"images"];
}

- (NSString *)largeImage {
return [self.dictionary objectForKey:@"large"];
NSMutableDictionary *dic = [self.dictionary objectForKey:@"images"];
if (!dic) {
return nil;
} else {
return [dic objectForKey:@"large"];
}
}

- (NSString *)smallImage {
return [self.dictionary objectForKey:@"small"];
NSMutableDictionary *dic = [self.dictionary objectForKey:@"images"];
if (!dic) {
return nil;
} else {
return [dic objectForKey:@"small"];
}
}

- (NSString *)mediumImage {
return [self.dictionary objectForKey:@"medium"];
NSMutableDictionary *dic = [self.dictionary objectForKey:@"images"];
if (!dic) {
return nil;
} else {
return [dic objectForKey:@"medium"];
}
}


- (NSString *)authorIntro {
return [self.dictionary objectForKey:@"author_intro"];
}
Expand Down

0 comments on commit 39f4aef

Please sign in to comment.