Manos Chorianopoulos

update Pacing Models

......@@ -2172,12 +2172,20 @@ public class swiftApi {
public class PacingDetails {
private var steps: PacingInner
private var meters: PacingDetailsInner
private var meters: PacingInner
public init() {
self.steps = PacingInner()
self.meters = PacingDetailsInner()
self.meters = PacingInner()
}
public init(dictionary: [String: Any]) {
let pacingDataSteps = (dictionary["steps"] as? [String: Any] ?? [String: Any]())
let pacingDataMeters = (dictionary["meters"] as? [String: Any] ?? [String: Any]())
self.steps = PacingInner(dictionary: pacingDataSteps)
self.meters = PacingInner(dictionary: pacingDataMeters)
}
public var _steps: PacingInner {
......@@ -2189,7 +2197,7 @@ public class swiftApi {
}
}
public var _meters: PacingDetailsInner {
public var _meters: PacingInner {
get { // getter
return self.meters
}
......@@ -2212,6 +2220,33 @@ public class swiftApi {
self.week = PacingDetailsInner()
self.day = PacingDetailsInner()
}
public init(dictionary: [String: Any]) {
if let stepsTotal = dictionary["total"] as? [String: Any] {
self.total = PacingDetailsInner(dictionary: stepsTotal)
} else {
self.total = PacingDetailsInner()
}
if let stepsMonth = dictionary["month"] as? [String: Any] {
self.month = PacingDetailsInner(dictionary: stepsMonth)
} else {
self.month = PacingDetailsInner()
}
if let stepsWeek = dictionary["week"] as? [String: Any] {
self.week = PacingDetailsInner(dictionary: stepsWeek)
} else {
self.week = PacingDetailsInner()
}
if let stepsDay = dictionary["day"] as? [String: Any] {
self.day = PacingDetailsInner(dictionary: stepsDay)
} else {
self.day = PacingDetailsInner()
}
}
public var _total: PacingDetailsInner {
get { // getter
......@@ -2263,6 +2298,22 @@ public class swiftApi {
}
public init(dictionary: [String: Any]) {
self.goal = dictionary["goal"] as? Float ?? 0.0
self.value = dictionary["value"] as? Float ?? 0.0
if let perDay = dictionary["per_day"] as? [[String: Any]] {
var tempPerDayArray: Array<PacingDetailsDay> = []
for item in perDay {
let newPerDayItem = PacingDetailsDay(dictionary: item)
tempPerDayArray.append(newPerDayItem)
}
self.per_day = tempPerDayArray
} else {
self.per_day = []
}
}
public var _goal: Float {
get { // getter
return self.goal
......@@ -2299,7 +2350,11 @@ public class swiftApi {
public init() {
self.day = ""
self.value = 0.0
}
public init(dictionary: [String: Any]) {
self.day = dictionary["day"] as? String ?? ""
self.value = dictionary["value"] as? Double ?? 0.0
}
public var _day: String {
......@@ -2321,4 +2376,5 @@ public class swiftApi {
}
}
}
......