diff --git a/WordPressKit.podspec b/WordPressKit.podspec index f2fa3102..b186b18a 100644 --- a/WordPressKit.podspec +++ b/WordPressKit.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = 'WordPressKit' - s.version = '4.44.0' + s.version = '4.45.0-beta.1' s.summary = 'WordPressKit offers a clean and simple WordPress.com and WordPress.org API.' s.description = <<-DESC diff --git a/WordPressKit/CommentServiceRemoteREST.m b/WordPressKit/CommentServiceRemoteREST.m index 94629020..157aba86 100644 --- a/WordPressKit/CommentServiceRemoteREST.m +++ b/WordPressKit/CommentServiceRemoteREST.m @@ -451,6 +451,7 @@ - (RemoteComment *)remoteCommentFromJSONDictionary:(NSDictionary *)jsonDictionar { RemoteComment *comment = [RemoteComment new]; + comment.authorID = [jsonDictionary numberForKeyPath:@"author.ID"]; comment.author = jsonDictionary[@"author"][@"name"]; // Email might be `false`, turn into `nil` comment.authorEmail = [jsonDictionary[@"author"] stringForKey:@"email"]; diff --git a/WordPressKit/RemoteComment.h b/WordPressKit/RemoteComment.h index 087e30d9..82c1917c 100644 --- a/WordPressKit/RemoteComment.h +++ b/WordPressKit/RemoteComment.h @@ -2,6 +2,7 @@ @interface RemoteComment : NSObject @property (nonatomic, strong) NSNumber *commentID; +@property (nonatomic, strong) NSNumber *authorID; @property (nonatomic, strong) NSString *author; @property (nonatomic, strong) NSString *authorEmail; @property (nonatomic, strong) NSString *authorUrl; diff --git a/WordPressKit/RemoteReaderPost.h b/WordPressKit/RemoteReaderPost.h index cf230911..f25b51a7 100644 --- a/WordPressKit/RemoteReaderPost.h +++ b/WordPressKit/RemoteReaderPost.h @@ -56,6 +56,7 @@ @property (nonatomic) BOOL receivesCommentNotifications; // Base Post Model +@property (nonatomic, strong) NSNumber *authorID; @property (nonatomic, strong) NSString *author; @property (nonatomic, strong) NSString *content; @property (nonatomic, strong) NSString *date_created_gmt; diff --git a/WordPressKit/RemoteReaderPost.m b/WordPressKit/RemoteReaderPost.m index a014a8cd..ee0032ed 100644 --- a/WordPressKit/RemoteReaderPost.m +++ b/WordPressKit/RemoteReaderPost.m @@ -92,6 +92,7 @@ - (instancetype)initWithDictionary:(NSDictionary *)dict; NSDictionary *authorDict = [dict dictionaryForKey:PostRESTKeyAuthor]; NSDictionary *discussionDict = [dict dictionaryForKey:PostRESTKeyDiscussion] ?: dict; + self.authorID = [authorDict numberForKey:PostRESTKeyID]; self.author = [self stringOrEmptyString:[authorDict stringForKey:PostRESTKeyNiceName]]; // typically the author's screen name self.authorAvatarURL = [self stringOrEmptyString:[authorDict stringForKey:PostRESTKeyAvatarURL]]; self.authorDisplayName = [[self stringOrEmptyString:[authorDict stringForKey:PostRESTKeyName]] stringByDecodingXMLCharacters]; // Typically the author's given name diff --git a/WordPressKitTests/CommentServiceRemoteRESTTests.swift b/WordPressKitTests/CommentServiceRemoteRESTTests.swift index 189ec002..6de8cb67 100644 --- a/WordPressKitTests/CommentServiceRemoteRESTTests.swift +++ b/WordPressKitTests/CommentServiceRemoteRESTTests.swift @@ -39,6 +39,7 @@ final class CommentServiceRemoteRESTTests: RemoteTestCase, RESTTestable { return } + XCTAssertEqual(comment.authorID, NSNumber(value: 12345)) XCTAssertEqual(comment.author, "Comment Author") XCTAssertEqual(comment.authorEmail, "author@email.com") XCTAssertEqual(comment.authorUrl, "author URL") diff --git a/WordPressKitTests/Mock Data/site-comments-success.json b/WordPressKitTests/Mock Data/site-comments-success.json index 8dc626f1..d8a42a4b 100644 --- a/WordPressKitTests/Mock Data/site-comments-success.json +++ b/WordPressKitTests/Mock Data/site-comments-success.json @@ -11,7 +11,7 @@ "link": "post URL" }, "author": { - "ID": 0, + "ID": 12345, "login": "", "email": "author@email.com", "name": "Comment Author",