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

Commit 988d3a5

Browse files
committed
Merge branch 'develop'
2 parents 71c7a0f + e4ba2bb commit 988d3a5

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

WordPressKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "WordPressKit"
3-
s.version = "4.4.0-beta.1"
3+
s.version = "4.4.0-beta.2"
44
s.summary = "WordPressKit offers a clean and simple WordPress.com and WordPress.org API."
55

66
s.description = <<-DESC

WordPressKit/Time Interval/StatsFileDownloadsTimeIntervalData.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ extension StatsFileDownloadsTimeIntervalData: StatsTimeIntervalData {
4949
}
5050

5151
let fileDownloads: [StatsFileDownload] = fileDownloadsDict.compactMap {
52-
// TODO: these keys are a total guess. Verify/update when the endpoint is actually live.
53-
guard let file = $0["file"] as? String, let downloads = $0["downloads"] as? Int else {
52+
guard let file = $0["filename"] as? String, let downloads = $0["downloads"] as? Int else {
5453
return nil
5554
}
5655

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
{
2-
"date": "2019-07-29",
3-
"period": "month",
4-
"days": {
5-
"2019-07-01": {
6-
"files": [],
7-
"other_downloads": 0,
8-
"total_downloads": 0
9-
}
10-
}
11-
}
2+
"date": "2019-07-29",
3+
"period": "month",
4+
"days": {
5+
"2019-07-01": {
6+
"files": [
7+
{
8+
"filename": "/2019/07/test.pdf",
9+
"downloads": 11
10+
},
11+
{
12+
"filename": "/2019/07/sampleaudio.mp3",
13+
"downloads": 4
14+
}
15+
],
16+
"other_downloads": 0,
17+
"total_downloads": 15
18+
}
19+
}
20+
}

WordPressKitTests/StatsRemoteV2Tests.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,6 @@ class StatsRemoteV2Tests: RemoteTestCase, RESTTestable {
367367
}
368368

369369
func testFetchDownloadsData() {
370-
371-
// TODO: update with real data once endpoint is live
372-
373370
let expect = expectation(description: "It should return file download data for a month")
374371

375372
let dateComponents = DateComponents(year: 2019, month: 7, day: 29)
@@ -382,13 +379,12 @@ class StatsRemoteV2Tests: RemoteTestCase, RESTTestable {
382379
XCTAssertNotNil(fileDownloads)
383380

384381
XCTAssertEqual(fileDownloads?.otherDownloadsCount, 0)
385-
XCTAssertEqual(fileDownloads?.totalDownloadsCount, 0)
382+
XCTAssertEqual(fileDownloads?.totalDownloadsCount, 15)
386383

387-
XCTAssertEqual(fileDownloads?.fileDownloads.count, 0)
384+
XCTAssertEqual(fileDownloads?.fileDownloads.count, 2)
388385

389-
// TODO: enable these (with valid tests) when endpoint is live
390-
// XCTAssertEqual(fileDownloads?.fileDownloads.first!.file, "")
391-
// XCTAssertEqual(fileDownloads?.fileDownloads.first!.downloadCount, 666)
386+
XCTAssertEqual(fileDownloads?.fileDownloads.first!.file, "/2019/07/test.pdf")
387+
XCTAssertEqual(fileDownloads?.fileDownloads.first!.downloadCount, 11)
392388

393389
expect.fulfill()
394390
}

0 commit comments

Comments
 (0)