{"action":"created","comment":{"url":"https://api.github.com/repos/michaelenger/sanntid/pulls/comments/26110095","id":26110095,"diff_hunk":"@@ -0,0 +1,116 @@\n+package sanntid\n+\n+import (\n+\t\"fmt\"\n+\t\"net/http\"\n+\t\"net/http/httptest\"\n+\t\"reflect\"\n+\t\"testing\"\n+)\n+\n+func TestArrivalDataUrl(t *testing.T) {\n+\texpected := \"http://reisapi.ruter.no/stopvisit/getdepartures/12345\"\n+\tresult := arrivalDataUrl(12345)\n+\n+\tif expected != result {\n+\t\tt.Errorf(\n+\t\t\t\"Expected URL == %q (got: %q)\",\n+\t\t\texpected,\n+\t\t\tresult)\n+\t}\n+}\n+\n+func TestRequestArrivalData(t *testing.T) {\n+\texampleText := \"Ruter API lol\"\n+\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n+\t\tfmt.Fprint(w, exampleText)\n+\t}))\n+\tdefer ts.Close()\n+\n+\texpected := []byte(exampleText)\n+\tresult, _ := requestArrivalData(ts.URL)\n+\n+\tif !reflect.DeepEqual(expected, result) {\n+\t\tt.Errorf(\n+\t\t\t\"Expected result == %q (got: %q)\",\n+\t\t\texpected,\n+\t\t\tresult)\n+\t}\n+}\n+\n+func TestParseArrivalData(t *testing.T) {\n+\texampleContent := []byte(`[\n+\t{\n+\t\t\"RecordedAtTime\":\"2015-02-27T12:29:41.618+01:00\",\n+\t\t\"MonitoringRef\":\"3010536\",\n+\t\t\"MonitoredVehicleJourney\":{\n+\t\t\t\"LineRef\":\"20\",\n+\t\t\t\"DirectionRef\":\"2\",\n+\t\t\t\"FramedVehicleJourneyRef\":{\n+\t\t\t\t\"DataFrameRef\":\n+\t\t\t\t\"2015-02-27\",\n+\t\t\t\t\"DatedVehicleJourneyRef\":\"5803\"\n+\t\t\t},\n+\t\t\t\"PublishedLineName\":\"20\",\n+\t\t\t\"DirectionName\":\"2\",\n+\t\t\t\"OperatorRef\":\"Unibuss\",\n+\t\t\t\"OriginName\":\"Galgeberg (i Jordalgata)\",\n+\t\t\t\"OriginRef\":\"3010640\",\n+\t\t\t\"DestinationRef\":3012501,\n+\t\t\t\"DestinationName\":\"Skøyen\",\n+\t\t\t\"OriginAimedDepartureTime\":\"0001-01-01T00:00:00\",\n+\t\t\t\"DestinationAimedArrivalTime\":\"0001-01-01T00:00:00\",\n+\t\t\t\"Monitored\":true,\n+\t\t\t\"InCongestion\":false,\n+\t\t\t\"Delay\":\"PT85S\",\n+\t\t\t\"TrainBlockPart\":null,\n+\t\t\t\"BlockRef\":\"2010\",\n+\t\t\t\"VehicleRef\":\"101047\",\n+\t\t\t\"VehicleMode\":0,\n+\t\t\t\"VehicleJourneyName\":\"20676\",\n+\t\t\t\"MonitoredCall\":{\n+\t\t\t\t\"VisitNumber\":5,\n+\t\t\t\t\"VehicleAtStop\":false,\n+\t\t\t\t\"DestinationDisplay\":\"Skøyen\",\n+\t\t\t\t\"AimedArrivalTime\":\"2015-02-27T12:29:00+01:00\",\n+\t\t\t\t\"ExpectedArrivalTime\":\"2015-02-27T12:30:25+01:00\",\n+\t\t\t\t\"AimedDepartureTime\":\"2015-02-27T12:29:00+01:00\",\n+\t\t\t\t\"ExpectedDepartureTime\":\"2015-02-27T12:30:25+01:00\",\n+\t\t\t\t\"DeparturePlatformName\":\"2\"\n+\t\t\t},\n+\t\t\t\"VehicleFeatureRef\":null\n+\t\t},\n+\t\t\"Extensions\":{\n+\t\t\t\"IsHub\":false,\n+\t\t\t\"OccupancyData\":{\n+\t\t\t\t\"OccupancyAvailable\":true,\n+\t\t\t\t\"OccupancyPercentage\":20\n+\t\t\t},\n+\t\t\t\"Deviations\":[],\n+\t\t\t\"LineColour\":\"E60000\"\n+\t\t}\n+\t}\n+\t]`)\n+\texpected := sanntidArrivalData{\n+\t\tsanntidMonitoredVehicleJourney{\n+\t\t\t\"Skøyen\",\n+\t\t\tsanntidMonitoredCall{\n+\t\t\t\t\"2015-02-27T12:30:25+01:00\",\n+\t\t\t\t\"2\",\n+\t\t\t\t\"Skøyen\",\n+\t\t\t},\n+\t\t\t\"20\",\n+\t\t\t0,\n+\t\t\t2,","path":"ruter_test.go","position":null,"original_position":104,"commit_id":"e316c1d1d83fb27f3cdb664863bb19424c7bbce0","original_commit_id":"2c56a8f8853a9a26336b51161be196948e27110e","user":{"login":"michaelenger","id":626587,"avatar_url":"https://avatars.githubusercontent.com/u/626587?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelenger","html_url":"https://github.com/michaelenger","followers_url":"https://api.github.com/users/michaelenger/followers","following_url":"https://api.github.com/users/michaelenger/following{/other_user}","gists_url":"https://api.github.com/users/michaelenger/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelenger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelenger/subscriptions","organizations_url":"https://api.github.com/users/michaelenger/orgs","repos_url":"https://api.github.com/users/michaelenger/repos","events_url":"https://api.github.com/users/michaelenger/events{/privacy}","received_events_url":"https://api.github.com/users/michaelenger/received_events","type":"User","site_admin":false},"body":"_Please forgive my lack of proper terminoloy._\r\n\r\n`sanntidDirection{2}` means that you are creating a new object and setting the value of the first property to be `2`. Instead you need to use `sanntidDirection(2)` which is casting the `int` into a `sanntidDirection` type, as far as I understood it.","created_at":"2015-03-10T10:16:56Z","updated_at":"2015-03-10T10:16:56Z","html_url":"https://github.com/michaelenger/sanntid/pull/7#discussion_r26110095","pull_request_url":"https://api.github.com/repos/michaelenger/sanntid/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/michaelenger/sanntid/pulls/comments/26110095"},"html":{"href":"https://github.com/michaelenger/sanntid/pull/7#discussion_r26110095"},"pull_request":{"href":"https://api.github.com/repos/michaelenger/sanntid/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/michaelenger/sanntid/pulls/7","id":30160704,"html_url":"https://github.com/michaelenger/sanntid/pull/7","diff_url":"https://github.com/michaelenger/sanntid/pull/7.diff","patch_url":"https://github.com/michaelenger/sanntid/pull/7.patch","issue_url":"https://api.github.com/repos/michaelenger/sanntid/issues/7","number":7,"state":"open","locked":false,"title":"Testing","user":{"login":"michaelenger","id":626587,"avatar_url":"https://avatars.githubusercontent.com/u/626587?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelenger","html_url":"https://github.com/michaelenger","followers_url":"https://api.github.com/users/michaelenger/followers","following_url":"https://api.github.com/users/michaelenger/following{/other_user}","gists_url":"https://api.github.com/users/michaelenger/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelenger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelenger/subscriptions","organizations_url":"https://api.github.com/users/michaelenger/orgs","repos_url":"https://api.github.com/users/michaelenger/repos","events_url":"https://api.github.com/users/michaelenger/events{/privacy}","received_events_url":"https://api.github.com/users/michaelenger/received_events","type":"User","site_admin":false},"body":"Started on some rudimentary testing.\r\n\r\nI'm curious as to what part of the application should handle the \"convert from Ruter format to our own (nicer) format\". If it should be in the ruter part of the app or the sanntid part. If we're building this as a CLI tool then we should probably get the sanntid stuff into a `main` package soon and try to think about what should go there and what can be deletated to the `ruter` part of the application.","created_at":"2015-02-27T11:55:44Z","updated_at":"2015-03-10T10:16:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"938891d2c61234d3ede3fc7916bbc7d03885d6be","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/michaelenger/sanntid/pulls/7/commits","review_comments_url":"https://api.github.com/repos/michaelenger/sanntid/pulls/7/comments","review_comment_url":"https://api.github.com/repos/michaelenger/sanntid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/michaelenger/sanntid/issues/7/comments","statuses_url":"https://api.github.com/repos/michaelenger/sanntid/statuses/e316c1d1d83fb27f3cdb664863bb19424c7bbce0","head":{"label":"michaelenger:testing","ref":"testing","sha":"e316c1d1d83fb27f3cdb664863bb19424c7bbce0","user":{"login":"michaelenger","id":626587,"avatar_url":"https://avatars.githubusercontent.com/u/626587?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelenger","html_url":"https://github.com/michaelenger","followers_url":"https://api.github.com/users/michaelenger/followers","following_url":"https://api.github.com/users/michaelenger/following{/other_user}","gists_url":"https://api.github.com/users/michaelenger/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelenger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelenger/subscriptions","organizations_url":"https://api.github.com/users/michaelenger/orgs","repos_url":"https://api.github.com/users/michaelenger/repos","events_url":"https://api.github.com/users/michaelenger/events{/privacy}","received_events_url":"https://api.github.com/users/michaelenger/received_events","type":"User","site_admin":false},"repo":{"id":31037232,"name":"sanntid","full_name":"michaelenger/sanntid","owner":{"login":"michaelenger","id":626587,"avatar_url":"https://avatars.githubusercontent.com/u/626587?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelenger","html_url":"https://github.com/michaelenger","followers_url":"https://api.github.com/users/michaelenger/followers","following_url":"https://api.github.com/users/michaelenger/following{/other_user}","gists_url":"https://api.github.com/users/michaelenger/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelenger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelenger/subscriptions","organizations_url":"https://api.github.com/users/michaelenger/orgs","repos_url":"https://api.github.com/users/michaelenger/repos","events_url":"https://api.github.com/users/michaelenger/events{/privacy}","received_events_url":"https://api.github.com/users/michaelenger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/michaelenger/sanntid","description":"Go package for retrieving realtime arrival data from the Ruter API","fork":false,"url":"https://api.github.com/repos/michaelenger/sanntid","forks_url":"https://api.github.com/repos/michaelenger/sanntid/forks","keys_url":"https://api.github.com/repos/michaelenger/sanntid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/michaelenger/sanntid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/michaelenger/sanntid/teams","hooks_url":"https://api.github.com/repos/michaelenger/sanntid/hooks","issue_events_url":"https://api.github.com/repos/michaelenger/sanntid/issues/events{/number}","events_url":"https://api.github.com/repos/michaelenger/sanntid/events","assignees_url":"https://api.github.com/repos/michaelenger/sanntid/assignees{/user}","branches_url":"https://api.github.com/repos/michaelenger/sanntid/branches{/branch}","tags_url":"https://api.github.com/repos/michaelenger/sanntid/tags","blobs_url":"https://api.github.com/repos/michaelenger/sanntid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/michaelenger/sanntid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/michaelenger/sanntid/git/refs{/sha}","trees_url":"https://api.github.com/repos/michaelenger/sanntid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/michaelenger/sanntid/statuses/{sha}","languages_url":"https://api.github.com/repos/michaelenger/sanntid/languages","stargazers_url":"https://api.github.com/repos/michaelenger/sanntid/stargazers","contributors_url":"https://api.github.com/repos/michaelenger/sanntid/contributors","subscribers_url":"https://api.github.com/repos/michaelenger/sanntid/subscribers","subscription_url":"https://api.github.com/repos/michaelenger/sanntid/subscription","commits_url":"https://api.github.com/repos/michaelenger/sanntid/commits{/sha}","git_commits_url":"https://api.github.com/repos/michaelenger/sanntid/git/commits{/sha}","comments_url":"https://api.github.com/repos/michaelenger/sanntid/comments{/number}","issue_comment_url":"https://api.github.com/repos/michaelenger/sanntid/issues/comments{/number}","contents_url":"https://api.github.com/repos/michaelenger/sanntid/contents/{+path}","compare_url":"https://api.github.com/repos/michaelenger/sanntid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/michaelenger/sanntid/merges","archive_url":"https://api.github.com/repos/michaelenger/sanntid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/michaelenger/sanntid/downloads","issues_url":"https://api.github.com/repos/michaelenger/sanntid/issues{/number}","pulls_url":"https://api.github.com/repos/michaelenger/sanntid/pulls{/number}","milestones_url":"https://api.github.com/repos/michaelenger/sanntid/milestones{/number}","notifications_url":"https://api.github.com/repos/michaelenger/sanntid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/michaelenger/sanntid/labels{/name}","releases_url":"https://api.github.com/repos/michaelenger/sanntid/releases{/id}","created_at":"2015-02-19T21:13:49Z","updated_at":"2015-02-26T22:34:22Z","pushed_at":"2015-03-10T10:15:22Z","git_url":"git://github.com/michaelenger/sanntid.git","ssh_url":"git@github.com:michaelenger/sanntid.git","clone_url":"https://github.com/michaelenger/sanntid.git","svn_url":"https://github.com/michaelenger/sanntid","homepage":null,"size":222,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":2,"default_branch":"master"}},"base":{"label":"michaelenger:master","ref":"master","sha":"1f88d2a463031dab15bc57d6407be12e3a2a540e","user":{"login":"michaelenger","id":626587,"avatar_url":"https://avatars.githubusercontent.com/u/626587?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelenger","html_url":"https://github.com/michaelenger","followers_url":"https://api.github.com/users/michaelenger/followers","following_url":"https://api.github.com/users/michaelenger/following{/other_user}","gists_url":"https://api.github.com/users/michaelenger/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelenger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelenger/subscriptions","organizations_url":"https://api.github.com/users/michaelenger/orgs","repos_url":"https://api.github.com/users/michaelenger/repos","events_url":"https://api.github.com/users/michaelenger/events{/privacy}","received_events_url":"https://api.github.com/users/michaelenger/received_events","type":"User","site_admin":false},"repo":{"id":31037232,"name":"sanntid","full_name":"michaelenger/sanntid","owner":{"login":"michaelenger","id":626587,"avatar_url":"https://avatars.githubusercontent.com/u/626587?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelenger","html_url":"https://github.com/michaelenger","followers_url":"https://api.github.com/users/michaelenger/followers","following_url":"https://api.github.com/users/michaelenger/following{/other_user}","gists_url":"https://api.github.com/users/michaelenger/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelenger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelenger/subscriptions","organizations_url":"https://api.github.com/users/michaelenger/orgs","repos_url":"https://api.github.com/users/michaelenger/repos","events_url":"https://api.github.com/users/michaelenger/events{/privacy}","received_events_url":"https://api.github.com/users/michaelenger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/michaelenger/sanntid","description":"Go package for retrieving realtime arrival data from the Ruter API","fork":false,"url":"https://api.github.com/repos/michaelenger/sanntid","forks_url":"https://api.github.com/repos/michaelenger/sanntid/forks","keys_url":"https://api.github.com/repos/michaelenger/sanntid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/michaelenger/sanntid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/michaelenger/sanntid/teams","hooks_url":"https://api.github.com/repos/michaelenger/sanntid/hooks","issue_events_url":"https://api.github.com/repos/michaelenger/sanntid/issues/events{/number}","events_url":"https://api.github.com/repos/michaelenger/sanntid/events","assignees_url":"https://api.github.com/repos/michaelenger/sanntid/assignees{/user}","branches_url":"https://api.github.com/repos/michaelenger/sanntid/branches{/branch}","tags_url":"https://api.github.com/repos/michaelenger/sanntid/tags","blobs_url":"https://api.github.com/repos/michaelenger/sanntid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/michaelenger/sanntid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/michaelenger/sanntid/git/refs{/sha}","trees_url":"https://api.github.com/repos/michaelenger/sanntid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/michaelenger/sanntid/statuses/{sha}","languages_url":"https://api.github.com/repos/michaelenger/sanntid/languages","stargazers_url":"https://api.github.com/repos/michaelenger/sanntid/stargazers","contributors_url":"https://api.github.com/repos/michaelenger/sanntid/contributors","subscribers_url":"https://api.github.com/repos/michaelenger/sanntid/subscribers","subscription_url":"https://api.github.com/repos/michaelenger/sanntid/subscription","commits_url":"https://api.github.com/repos/michaelenger/sanntid/commits{/sha}","git_commits_url":"https://api.github.com/repos/michaelenger/sanntid/git/commits{/sha}","comments_url":"https://api.github.com/repos/michaelenger/sanntid/comments{/number}","issue_comment_url":"https://api.github.com/repos/michaelenger/sanntid/issues/comments{/number}","contents_url":"https://api.github.com/repos/michaelenger/sanntid/contents/{+path}","compare_url":"https://api.github.com/repos/michaelenger/sanntid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/michaelenger/sanntid/merges","archive_url":"https://api.github.com/repos/michaelenger/sanntid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/michaelenger/sanntid/downloads","issues_url":"https://api.github.com/repos/michaelenger/sanntid/issues{/number}","pulls_url":"https://api.github.com/repos/michaelenger/sanntid/pulls{/number}","milestones_url":"https://api.github.com/repos/michaelenger/sanntid/milestones{/number}","notifications_url":"https://api.github.com/repos/michaelenger/sanntid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/michaelenger/sanntid/labels{/name}","releases_url":"https://api.github.com/repos/michaelenger/sanntid/releases{/id}","created_at":"2015-02-19T21:13:49Z","updated_at":"2015-02-26T22:34:22Z","pushed_at":"2015-03-10T10:15:22Z","git_url":"git://github.com/michaelenger/sanntid.git","ssh_url":"git@github.com:michaelenger/sanntid.git","clone_url":"https://github.com/michaelenger/sanntid.git","svn_url":"https://github.com/michaelenger/sanntid","homepage":null,"size":222,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/michaelenger/sanntid/pulls/7"},"html":{"href":"https://github.com/michaelenger/sanntid/pull/7"},"issue":{"href":"https://api.github.com/repos/michaelenger/sanntid/issues/7"},"comments":{"href":"https://api.github.com/repos/michaelenger/sanntid/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/michaelenger/sanntid/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/michaelenger/sanntid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/michaelenger/sanntid/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/michaelenger/sanntid/statuses/e316c1d1d83fb27f3cdb664863bb19424c7bbce0"}}}}