Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit d4bfabc

Browse files
authored
Merge pull request #501 from wordpress-mobile/feature/blogging-prompts-attribution-field
Add attribution field to blogging prompts
2 parents ada3845 + f69ef59 commit d4bfabc

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

WordPressKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Pod::Spec.new do |s|
44
s.name = 'WordPressKit'
5-
s.version = '4.51.0'
5+
s.version = '4.52.0-beta.1'
66

77
s.summary = 'WordPressKit offers a clean and simple WordPress.com and WordPress.org API.'
88
s.description = <<-DESC

WordPressKit/RemoteBloggingPrompt.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ public struct RemoteBloggingPrompt {
33
public var text: String
44
public var title: String
55
public var content: String
6+
public var attribution: String
67
public var date: Date
78
public var answered: Bool
89
public var answeredUsersCount: Int
@@ -17,6 +18,7 @@ extension RemoteBloggingPrompt: Decodable {
1718
case text
1819
case title
1920
case content
21+
case attribution
2022
case date
2123
case answered
2224
case answeredUsersCount = "answered_users_count"
@@ -30,6 +32,7 @@ extension RemoteBloggingPrompt: Decodable {
3032
self.text = try container.decode(String.self, forKey: .text)
3133
self.title = try container.decode(String.self, forKey: .title)
3234
self.content = try container.decode(String.self, forKey: .content)
35+
self.attribution = try container.decode(String.self, forKey: .attribution)
3336
self.answered = try container.decode(Bool.self, forKey: .answered)
3437
self.date = try container.decode(Date.self, forKey: .date)
3538
self.answeredUsersCount = try container.decode(Int.self, forKey: .answeredUsersCount)

WordPressKitTests/BloggingPromptsServiceRemoteTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ class BloggingPromptsServiceRemoteTests: RemoteTestCase, RESTTestable {
4848
XCTAssertEqual(firstPrompt.text, "Was there a toy or thing you always wanted as a child, during the holidays or on your birthday, but never received? Tell us about it.")
4949
XCTAssertEqual(firstPrompt.title, "Prompt number 1")
5050
XCTAssertEqual(firstPrompt.content, "<!-- wp:pullquote -->\n<figure class=\"wp-block-pullquote\"><blockquote><p>Was there a toy or thing you always wanted as a child, during the holidays or on your birthday, but never received? Tell us about it.</p><cite>(courtesy of plinky.com)</cite></blockquote></figure>\n<!-- /wp:pullquote -->")
51+
XCTAssertEqual(firstPrompt.attribution, "dayone")
5152
XCTAssertEqual(firstPrompt.date, expectedDate)
5253
XCTAssertFalse(firstPrompt.answered)
5354
XCTAssertEqual(firstPrompt.answeredUsersCount, 0)
5455

5556
let secondPrompt = prompts.last!
5657
XCTAssertEqual(secondPrompt.answeredUsersCount, 1)
5758
XCTAssertEqual(secondPrompt.answeredUserAvatarURLs.count, 1)
59+
XCTAssertTrue(secondPrompt.attribution.isEmpty)
5860

5961
let avatarURL = secondPrompt.answeredUserAvatarURLs.first!
6062
XCTAssertEqual(avatarURL.absoluteString, expectedAvatarURLString)

WordPressKitTests/Mock Data/blogging-prompts-success.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"text": "Was there a toy or thing you always wanted as a child, during the holidays or on your birthday, but never received? Tell us about it.",
66
"title": "Prompt number 1",
77
"content": "<!-- wp:pullquote -->\n<figure class=\"wp-block-pullquote\"><blockquote><p>Was there a toy or thing you always wanted as a child, during the holidays or on your birthday, but never received? Tell us about it.</p><cite>(courtesy of plinky.com)</cite></blockquote></figure>\n<!-- /wp:pullquote -->",
8+
"attribution": "dayone",
89
"date": "2022-01-01",
910
"answered": false,
1011
"answered_users_count": 0,
@@ -15,6 +16,7 @@
1516
"text": "Tell us about a time when you felt out of place.",
1617
"title": "Prompt number 10",
1718
"content": "<!-- wp:pullquote -->\n<figure class=\"wp-block-pullquote\"><blockquote><p>Tell us about a time when you felt out of place.</p><cite>(courtesy of plinky.com)</cite></blockquote></figure>\n<!-- /wp:pullquote -->",
19+
"attribution": "",
1820
"date": "2022-01-02",
1921
"answered": false,
2022
"answered_users_count": 1,

0 commit comments

Comments
 (0)