{"action":"created","comment":{"url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls/comments/238079964","pull_request_review_id":180542132,"id":238079964,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzODA3OTk2NA==","diff_hunk":"@@ -0,0 +1,355 @@\n+//\n+//  FetchNetwork.swift\n+//  FetchTrainNetwork\n+//\n+//  Created by Ryan Krol on 24/11/2018.\n+//\n+//  Song: The Rapture - Echoes\n+\n+import Foundation\n+import SwiftyJSON\n+import HeliumLogger\n+import LoggerAPI\n+\n+public class NetworkFetcher {\n+\n+    private static let inProgressFile = URL(string: \"FetchNetworkDocs/InProgress/network.txt\")!\n+    private static let inProgressLinksFile = URL(string: \"FetchNetworkDocs/InProgress/links.txt\")!\n+    private static let inProgressTrainLinesFile = URL(string: \"FetchNetworkDocs/InProgress/trainLines.txt\")!\n+    private static let fileManager    = FileManager.default\n+    private static let docDirectory   = FileManager.default.urls(\n+        for: .documentDirectory,\n+        in: .userDomainMask\n+    ).first\n+    private static let appId  = \"6ea73f04\"\n+    private static let appKey = \"35406e49c2580c682c99d7b670615315\"\n+\n+    private static let linkDataStoredCount = 3\n+\n+    private static let originStationPosition = 0\n+    private static let destinationStationPosition = 1\n+    private static let journeyTimePosition = 2\n+\n+    private static let usageExceededErrorCode = 403\n+    private static let badRequestErrorCode = 400\n+\n+    private static var linesSkipped = 0\n+    private static var urlCreationSkipped = 0\n+    private static var linksAdded = 0\n+    private static var linesAdded = 0\n+\n+    private static var urlsFailed: Set<String> = []\n+\n+    enum APIError: Error {\n+        case UsageExceeded\n+        case BadRequest\n+        case UnknownError\n+        case FailedTrainLineFetch\n+        case FailedDepartureBoardFetch\n+    }\n+\n+    // fetch stations to build graph with\n+    public static func getNetwork(with stations: [String]) throws -> [(String, String, Int)] {\n+\n+        let currentStationIndex = try NetworkProgress.getStartingStationIndex(stations)\n+\n+        // fetch the current train links\n+        var currentTrainLines = try NetworkProgress.getCurrentStationLines()\n+\n+        // fetch the current station links\n+        var currentLinks = try NetworkProgress.getCurrentStationLinks()\n+\n+        defer {\n+            Log.info(\"Number of skipped API calls is: \\(linesSkipped)\")\n+            Log.info(\"Failed API parsing count: \\(urlCreationSkipped)\")\n+            Log.info(\"Failed URLs: \\(urlsFailed)\")\n+            Log.info(\"Links Added: \\(linksAdded)\")\n+            Log.info(\"Lines Added: \\(linesAdded)\")\n+            Log.info(\"# Links we started with: \\(currentLinks.count)\")\n+        }\n+\n+        for i in currentStationIndex..<stations.count {\n+\n+            let station = stations[i]\n+\n+            // fetch the departure board\n+            // TODO: Have this data passed in to us","path":"Sources/ExodusLib/Link Loading/FetchNetwork.swift","position":76,"original_position":76,"commit_id":"a3b1b889494e187ac3d2e7ef66d2ab5bb572df90","original_commit_id":"a3b1b889494e187ac3d2e7ef66d2ab5bb572df90","user":{"login":"houndci-bot","id":6697940,"node_id":"MDQ6VXNlcjY2OTc5NDA=","avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Todo Violation: TODOs should be resolved (Have this data passed in to us). (todo)","created_at":"2018-12-01T23:35:17Z","updated_at":"2018-12-01T23:35:19Z","html_url":"https://github.com/InsertGreatNameHere/Exodus/pull/6#discussion_r238079964","pull_request_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls/6","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls/comments/238079964"},"html":{"href":"https://github.com/InsertGreatNameHere/Exodus/pull/6#discussion_r238079964"},"pull_request":{"href":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls/6","id":233336223,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzMzM2MjIz","html_url":"https://github.com/InsertGreatNameHere/Exodus/pull/6","diff_url":"https://github.com/InsertGreatNameHere/Exodus/pull/6.diff","patch_url":"https://github.com/InsertGreatNameHere/Exodus/pull/6.patch","issue_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/issues/6","number":6,"state":"open","locked":false,"title":"Add Ryan's base code","user":{"login":"RyanMKrol","id":16356366,"node_id":"MDQ6VXNlcjE2MzU2MzY2","avatar_url":"https://avatars3.githubusercontent.com/u/16356366?v=4","gravatar_id":"","url":"https://api.github.com/users/RyanMKrol","html_url":"https://github.com/RyanMKrol","followers_url":"https://api.github.com/users/RyanMKrol/followers","following_url":"https://api.github.com/users/RyanMKrol/following{/other_user}","gists_url":"https://api.github.com/users/RyanMKrol/gists{/gist_id}","starred_url":"https://api.github.com/users/RyanMKrol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RyanMKrol/subscriptions","organizations_url":"https://api.github.com/users/RyanMKrol/orgs","repos_url":"https://api.github.com/users/RyanMKrol/repos","events_url":"https://api.github.com/users/RyanMKrol/events{/privacy}","received_events_url":"https://api.github.com/users/RyanMKrol/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-24T19:32:55Z","updated_at":"2018-12-01T23:35:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88f935321a3fb6f02f5198f073197c645bded0ec","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls/6/commits","review_comments_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls/6/comments","review_comment_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/issues/6/comments","statuses_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/statuses/a3b1b889494e187ac3d2e7ef66d2ab5bb572df90","head":{"label":"InsertGreatNameHere:link-loading","ref":"link-loading","sha":"a3b1b889494e187ac3d2e7ef66d2ab5bb572df90","user":{"login":"InsertGreatNameHere","id":44736501,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0NzM2NTAx","avatar_url":"https://avatars1.githubusercontent.com/u/44736501?v=4","gravatar_id":"","url":"https://api.github.com/users/InsertGreatNameHere","html_url":"https://github.com/InsertGreatNameHere","followers_url":"https://api.github.com/users/InsertGreatNameHere/followers","following_url":"https://api.github.com/users/InsertGreatNameHere/following{/other_user}","gists_url":"https://api.github.com/users/InsertGreatNameHere/gists{/gist_id}","starred_url":"https://api.github.com/users/InsertGreatNameHere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InsertGreatNameHere/subscriptions","organizations_url":"https://api.github.com/users/InsertGreatNameHere/orgs","repos_url":"https://api.github.com/users/InsertGreatNameHere/repos","events_url":"https://api.github.com/users/InsertGreatNameHere/events{/privacy}","received_events_url":"https://api.github.com/users/InsertGreatNameHere/received_events","type":"Organization","site_admin":false},"repo":{"id":156034336,"node_id":"MDEwOlJlcG9zaXRvcnkxNTYwMzQzMzY=","name":"Exodus","full_name":"InsertGreatNameHere/Exodus","private":false,"owner":{"login":"InsertGreatNameHere","id":44736501,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0NzM2NTAx","avatar_url":"https://avatars1.githubusercontent.com/u/44736501?v=4","gravatar_id":"","url":"https://api.github.com/users/InsertGreatNameHere","html_url":"https://github.com/InsertGreatNameHere","followers_url":"https://api.github.com/users/InsertGreatNameHere/followers","following_url":"https://api.github.com/users/InsertGreatNameHere/following{/other_user}","gists_url":"https://api.github.com/users/InsertGreatNameHere/gists{/gist_id}","starred_url":"https://api.github.com/users/InsertGreatNameHere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InsertGreatNameHere/subscriptions","organizations_url":"https://api.github.com/users/InsertGreatNameHere/orgs","repos_url":"https://api.github.com/users/InsertGreatNameHere/repos","events_url":"https://api.github.com/users/InsertGreatNameHere/events{/privacy}","received_events_url":"https://api.github.com/users/InsertGreatNameHere/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/InsertGreatNameHere/Exodus","description":null,"fork":false,"url":"https://api.github.com/repos/InsertGreatNameHere/Exodus","forks_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/forks","keys_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/teams","hooks_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/hooks","issue_events_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/issues/events{/number}","events_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/events","assignees_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/assignees{/user}","branches_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/branches{/branch}","tags_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/tags","blobs_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/git/refs{/sha}","trees_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/statuses/{sha}","languages_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/languages","stargazers_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/stargazers","contributors_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/contributors","subscribers_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/subscribers","subscription_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/subscription","commits_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/commits{/sha}","git_commits_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/git/commits{/sha}","comments_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/comments{/number}","issue_comment_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/issues/comments{/number}","contents_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/contents/{+path}","compare_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/merges","archive_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/downloads","issues_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/issues{/number}","pulls_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls{/number}","milestones_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/milestones{/number}","notifications_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/labels{/name}","releases_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/releases{/id}","deployments_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/deployments","created_at":"2018-11-04T00:01:21Z","updated_at":"2018-11-25T17:34:53Z","pushed_at":"2018-12-01T23:34:45Z","git_url":"git://github.com/InsertGreatNameHere/Exodus.git","ssh_url":"git@github.com:InsertGreatNameHere/Exodus.git","clone_url":"https://github.com/InsertGreatNameHere/Exodus.git","svn_url":"https://github.com/InsertGreatNameHere/Exodus","homepage":null,"size":40,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"InsertGreatNameHere:master","ref":"master","sha":"b986df95d6cd9e5daa6196e7f75c988c513238d2","user":{"login":"InsertGreatNameHere","id":44736501,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0NzM2NTAx","avatar_url":"https://avatars1.githubusercontent.com/u/44736501?v=4","gravatar_id":"","url":"https://api.github.com/users/InsertGreatNameHere","html_url":"https://github.com/InsertGreatNameHere","followers_url":"https://api.github.com/users/InsertGreatNameHere/followers","following_url":"https://api.github.com/users/InsertGreatNameHere/following{/other_user}","gists_url":"https://api.github.com/users/InsertGreatNameHere/gists{/gist_id}","starred_url":"https://api.github.com/users/InsertGreatNameHere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InsertGreatNameHere/subscriptions","organizations_url":"https://api.github.com/users/InsertGreatNameHere/orgs","repos_url":"https://api.github.com/users/InsertGreatNameHere/repos","events_url":"https://api.github.com/users/InsertGreatNameHere/events{/privacy}","received_events_url":"https://api.github.com/users/InsertGreatNameHere/received_events","type":"Organization","site_admin":false},"repo":{"id":156034336,"node_id":"MDEwOlJlcG9zaXRvcnkxNTYwMzQzMzY=","name":"Exodus","full_name":"InsertGreatNameHere/Exodus","private":false,"owner":{"login":"InsertGreatNameHere","id":44736501,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0NzM2NTAx","avatar_url":"https://avatars1.githubusercontent.com/u/44736501?v=4","gravatar_id":"","url":"https://api.github.com/users/InsertGreatNameHere","html_url":"https://github.com/InsertGreatNameHere","followers_url":"https://api.github.com/users/InsertGreatNameHere/followers","following_url":"https://api.github.com/users/InsertGreatNameHere/following{/other_user}","gists_url":"https://api.github.com/users/InsertGreatNameHere/gists{/gist_id}","starred_url":"https://api.github.com/users/InsertGreatNameHere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InsertGreatNameHere/subscriptions","organizations_url":"https://api.github.com/users/InsertGreatNameHere/orgs","repos_url":"https://api.github.com/users/InsertGreatNameHere/repos","events_url":"https://api.github.com/users/InsertGreatNameHere/events{/privacy}","received_events_url":"https://api.github.com/users/InsertGreatNameHere/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/InsertGreatNameHere/Exodus","description":null,"fork":false,"url":"https://api.github.com/repos/InsertGreatNameHere/Exodus","forks_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/forks","keys_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/teams","hooks_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/hooks","issue_events_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/issues/events{/number}","events_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/events","assignees_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/assignees{/user}","branches_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/branches{/branch}","tags_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/tags","blobs_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/git/refs{/sha}","trees_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/statuses/{sha}","languages_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/languages","stargazers_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/stargazers","contributors_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/contributors","subscribers_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/subscribers","subscription_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/subscription","commits_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/commits{/sha}","git_commits_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/git/commits{/sha}","comments_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/comments{/number}","issue_comment_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/issues/comments{/number}","contents_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/contents/{+path}","compare_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/merges","archive_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/downloads","issues_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/issues{/number}","pulls_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls{/number}","milestones_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/milestones{/number}","notifications_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/labels{/name}","releases_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/releases{/id}","deployments_url":"https://api.github.com/repos/InsertGreatNameHere/Exodus/deployments","created_at":"2018-11-04T00:01:21Z","updated_at":"2018-11-25T17:34:53Z","pushed_at":"2018-12-01T23:34:45Z","git_url":"git://github.com/InsertGreatNameHere/Exodus.git","ssh_url":"git@github.com:InsertGreatNameHere/Exodus.git","clone_url":"https://github.com/InsertGreatNameHere/Exodus.git","svn_url":"https://github.com/InsertGreatNameHere/Exodus","homepage":null,"size":40,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls/6"},"html":{"href":"https://github.com/InsertGreatNameHere/Exodus/pull/6"},"issue":{"href":"https://api.github.com/repos/InsertGreatNameHere/Exodus/issues/6"},"comments":{"href":"https://api.github.com/repos/InsertGreatNameHere/Exodus/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/InsertGreatNameHere/Exodus/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/InsertGreatNameHere/Exodus/statuses/a3b1b889494e187ac3d2e7ef66d2ab5bb572df90"}},"author_association":"NONE"}}
{"actor":{"display_login":"houndci-bot"}}