Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion WordPressKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Pod::Spec.new do |s|
s.name = 'WordPressKit'
s.version = '4.47.0'
s.version = '4.48.0-beta.1'

s.summary = 'WordPressKit offers a clean and simple WordPress.com and WordPress.org API.'
s.description = <<-DESC
Expand Down
2 changes: 1 addition & 1 deletion WordPressKit/DashboardServiceRemote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open class DashboardServiceRemote: ServiceRemoteWordPressComREST {
}

private func endpoint(for cards: [String], blogID: Int) -> String? {
var path = URLComponents(string: "sites/\(blogID)/dashboard/cards/v1_1/")
var path = URLComponents(string: "sites/\(blogID)/dashboard/cards-data/")

let cardsEncoded = cards.joined(separator: ",")
path?.queryItems = [URLQueryItem(name: "cards", value: cardsEncoded)]
Expand Down
10 changes: 5 additions & 5 deletions WordPressKitTests/DashboardServiceRemoteTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DashboardServiceRemoteTests: RemoteTestCase, RESTTestable {
//
func testRequestCardsParam() {
let expect = expectation(description: "Get cards successfully")
stubRemoteResponse("wpcom/v2/sites/165243437/dashboard/cards/v1_1/?cards=posts,todays_stats", filename: "dashboard-200-with-drafts-and-scheduled-posts.json", contentType: .ApplicationJSON)
stubRemoteResponse("wpcom/v2/sites/165243437/dashboard/cards-data/?cards=posts,todays_stats", filename: "dashboard-200-with-drafts-and-scheduled-posts.json", contentType: .ApplicationJSON)

dashboardServiceRemote.fetch(cards: ["posts", "todays_stats"], forBlogID: 165243437) { _ in
expect.fulfill()
Expand All @@ -27,7 +27,7 @@ class DashboardServiceRemoteTests: RemoteTestCase, RESTTestable {
//
func testRequestCards() {
let expect = expectation(description: "Get cards successfully")
stubRemoteResponse("wpcom/v2/sites/165243437/dashboard/cards/v1_1/?cards=posts,todays_stats", filename: "dashboard-200-with-drafts-and-scheduled-posts.json", contentType: .ApplicationJSON)
stubRemoteResponse("wpcom/v2/sites/165243437/dashboard/cards-data/?cards=posts,todays_stats", filename: "dashboard-200-with-drafts-and-scheduled-posts.json", contentType: .ApplicationJSON)

dashboardServiceRemote.fetch(cards: ["posts", "todays_stats"], forBlogID: 165243437) { cards in
XCTAssertTrue((cards["posts"] as! NSDictionary)["has_published"] as! Bool)
Expand All @@ -42,7 +42,7 @@ class DashboardServiceRemoteTests: RemoteTestCase, RESTTestable {
//
func testRequestFails() {
let expect = expectation(description: "Get cards successfully")
stubRemoteResponse("wpcom/v2/sites/165243437/dashboard/cards/v1_1/?cards=posts,todays_stats", filename: "dashboard-200-with-drafts-and-scheduled-posts.json", contentType: .ApplicationJSON, status: 503)
stubRemoteResponse("wpcom/v2/sites/165243437/dashboard/cards-data/?cards=posts,todays_stats", filename: "dashboard-200-with-drafts-and-scheduled-posts.json", contentType: .ApplicationJSON, status: 503)

dashboardServiceRemote.fetch(cards: ["posts", "todays_stats"], forBlogID: 165243437) { _ in
XCTFail("This call should not suceed")
Expand All @@ -57,7 +57,7 @@ class DashboardServiceRemoteTests: RemoteTestCase, RESTTestable {
//
func testRequestInvalidCard() {
let expect = expectation(description: "Get cards successfully")
stubRemoteResponse("wpcom/v2/sites/165243437/dashboard/cards/v1_1/?cards=invalid_card", filename: "dashboard-400-invalid-card.json", contentType: .ApplicationJSON, status: 400)
stubRemoteResponse("wpcom/v2/sites/165243437/dashboard/cards-data/?cards=invalid_card", filename: "dashboard-400-invalid-card.json", contentType: .ApplicationJSON, status: 400)

dashboardServiceRemote.fetch(cards: ["invalid_card"], forBlogID: 165243437) { _ in
XCTFail("This call should not suceed")
Expand All @@ -72,7 +72,7 @@ class DashboardServiceRemoteTests: RemoteTestCase, RESTTestable {
//
func testRequestInvalidJSON() {
let expect = expectation(description: "Get cards successfully")
stubRemoteResponse("wpcom/v2/sites/165243437/dashboard/cards/v1_1/?cards=posts,todays_stats", data: "foo".data(using: .utf8)!, contentType: .ApplicationJSON)
stubRemoteResponse("wpcom/v2/sites/165243437/dashboard/cards-data/?cards=posts,todays_stats", data: "foo".data(using: .utf8)!, contentType: .ApplicationJSON)

dashboardServiceRemote.fetch(cards: ["posts", "todays_stats"], forBlogID: 165243437) { _ in
XCTFail("This call should not suceed")
Expand Down