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
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "WordPressKit"
s.version = "4.1.1"
s.version = "4.1.2-beta.1"
s.summary = "WordPressKit offers a clean and simple WordPress.com and WordPress.org API."

s.description = <<-DESC
Expand Down
11 changes: 5 additions & 6 deletions WordPressKit/StatsServiceRemoteV2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ public class StatsServiceRemoteV2: ServiceRemoteWordPressComREST {
let path = self.path(forEndpoint: "sites/\(siteID)/\(pathComponent)/", withVersion: ._1_1)

let staticProperties = ["period": period.stringValue,
"date": periodDataQueryDateFormatter.string(from: endingOn),
"max": limit as AnyObject] as [String: AnyObject]
"date": periodDataQueryDateFormatter.string(from: endingOn)] as [String: AnyObject]

let classProperties = TimeStatsType.queryProperties(with: endingOn, period: period) as [String: AnyObject]
let classProperties = TimeStatsType.queryProperties(with: endingOn, period: period, maxCount: limit) as [String: AnyObject]

let properties = staticProperties.merging(classProperties) { val1, _ in
return val1
Expand Down Expand Up @@ -263,13 +262,13 @@ public protocol StatsTimeIntervalData {

init?(date: Date, period: StatsPeriodUnit, jsonDictionary: [String: AnyObject])

static func queryProperties(with date: Date, period: StatsPeriodUnit) -> [String: String]
static func queryProperties(with date: Date, period: StatsPeriodUnit, maxCount: Int) -> [String: String]
}

extension StatsTimeIntervalData {

public static func queryProperties(with date: Date, period: StatsPeriodUnit) -> [String: String] {
return [:]
public static func queryProperties(with date: Date, period: StatsPeriodUnit, maxCount: Int) -> [String: String] {
return ["max": String(maxCount)]
}

// Most of the responses for time data come in a unwieldy format, that requires awkwkard unwrapping
Expand Down
7 changes: 3 additions & 4 deletions WordPressKit/Time Interval/StatsSummaryTimeIntervalData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ extension StatsSummaryTimeIntervalData: StatsTimeIntervalData {
return "stats/visits"
}

public static func queryProperties(with date: Date, period: StatsPeriodUnit) -> [String: String] {
return ["quantity": "10",
"stat_fields": "views,visitors,likes,comments",
"unit": period.stringValue]
public static func queryProperties(with date: Date, period: StatsPeriodUnit, maxCount: Int) -> [String : String] {
return ["unit": period.stringValue,
"quantity": String(maxCount)]
}

public init?(date: Date, period: StatsPeriodUnit, jsonDictionary: [String : AnyObject]) {
Expand Down