Commit 35f44450 authored by Eyad Hasan's avatar Eyad Hasan
Browse files

Adding new Objects

Started working on new objects to store our data, currently broken until I fix everything, also I had todo a pod install to get realm back in the project. I sure hope this doens't cause merg conflicts when it's done. plz no
parent 228357b8
......@@ -12,6 +12,6 @@ SPEC CHECKSUMS:
Realm: 32f86104d37c8521f864d4274050b38ba6190733
RealmSwift: f719e7511c902b8908593e8f143f59e47931bdb6
PODFILE CHECKSUM: 82a8c02976dd8361f0b1b16656b12739ed08c3af
PODFILE CHECKSUM: b8c4ac0f68e1021098d7016accb14cf642240f47
COCOAPODS: 1.2.1
......@@ -12,6 +12,6 @@ SPEC CHECKSUMS:
Realm: 32f86104d37c8521f864d4274050b38ba6190733
RealmSwift: f719e7511c902b8908593e8f143f59e47931bdb6
PODFILE CHECKSUM: 82a8c02976dd8361f0b1b16656b12739ed08c3af
PODFILE CHECKSUM: b8c4ac0f68e1021098d7016accb14cf642240f47
COCOAPODS: 1.2.1
......@@ -8,8 +8,47 @@ import RealmSwift
final class Facility: CreatableFromJSON {
dynamic var slug: String = ""
dynamic var name: String = ""
dynamic var location: Any?
dynamic var category: Any?
dynamic var tags: Array<Any>
let mainSchedule = List<MainSchedule>()
}
final class MainSchedule: CreatableFromJSON {
/// Attempts to configure a new instance of the conforming type with values from a JSON dictionary.
init?(json: [String : Any]) {
<#code#>
}
dynamic var id: String = ""
dynamic var openTimes = [OpenTimes]()
}
struct OpenTimes: CreatableFromJSON { // TODO: Rename this struct
final class OpenTimes: CreatableFromJSON {
/// Attempts to configure a new instance of the conforming type with values from a JSON dictionary.
init?(json: [String : Any]) {
<#code#>
}
dynamic var schedule: Int
dynamic var modified: String
dynamic var startDay: Int
dynamic var endDay: Int
dynamic var startTime: String
dynamic var endTime: String
}
/**struct OpenTimes: CreatableFromJSON { // TODO: Rename this struct
let endDay: Int
let endTime: Date
let id: Int
......@@ -118,7 +157,7 @@ struct Facility: CreatableFromJSON { // TODO: Rename this struct
}
}
}
**/
//
// MARK: - JSON Utilities
//
......
......@@ -11,12 +11,9 @@ import Foundation
class SRCTNetworkController: NSObject {
//Use this for testing with the new API, might make it possible to get stuff moving pre official release
//https://whatsopen.dhaynes.xyz/api/facilities/?format=json
//Official SRCT link.
//https://whatsopen.gmu.edu/api/facilities/?format=json
//https://api.srct.gmu.edu/whatsopen/v2/facilities/?format=json
public static func performDownload(completion: @escaping (_ result: Array<Facility>) -> Void) {
let requestURL: NSURL = NSURL(string: "https://whatsopen.dhaynes.xyz/api/facilities/?format=json")!
let requestURL: NSURL = NSURL(string: "https://api.srct.gmu.edu/whatsopen/v2/facilities/?format=json")!
let urlRequest: NSMutableURLRequest = NSMutableURLRequest(url: requestURL as URL)
let session = URLSession.shared
let task = session.dataTask(with: urlRequest as URLRequest) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment