{"action":"created","comment":{"url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/comments/23544769","id":23544769,"diff_hunk":"@@ -0,0 +1,56 @@\n+CAC.Map.Routing = (function($, moment, UserModes) {\n+    'use strict'\n+\n+    var planMode = ['WALK', 'TRANSIT'];\n+    var routingUrl = '/otp/routers/default/plan';\n+    var module = {\n+        planTrip: planTrip\n+    };\n+    return module;\n+\n+    /**\n+     * Find shortest path from one point to another\n+     *\n+     * @param coordsFrom {array} The coords in lat-lng which we would like to travel from\n+     * @param coordsTo {array} The coords in lat-lng which we would like to travel to\n+     *\n+     * @return {object} (promise) The promise object which - if successful - resolves in a\n+     *                              geoJSON representation of a trip\n+     */\n+    function planTrip(coordsFrom, coordsTo) {\n+        var deferred = $.Deferred();\n+        var urlParams = prepareParamString(coordsFrom, coordsTo);\n+        var requestUrl = routingUrl + '?' + urlParams;\n+        $.ajax({\n+            url: requestUrl,\n+            type: 'GET',\n+            contentType: 'application/json'\n+        }).then(deferred.resolve);\n+        return deferred.promise();\n+    }\n+\n+\n+    /**\n+     * Helper function to prepare the parameter string for consumption by the OTP api\n+     *\n+     * @param coordsFrom {array} The coords in lat-lng which we would like to travel from\n+     * @param coordsTo {array} The coords in lat-lng which we would like to travel to\n+     *\n+     * @return {string} A set of get params, ready for consumption\n+     */\n+    function prepareParamString(coordsFrom, coordsTo) {\n+        var currentTime = moment();","path":"src/app/scripts/cac/map/cac-map-routing.js","position":42,"original_position":42,"commit_id":"2472706152f190dcba4518d9de2a80e05cc845e9","original_commit_id":"2472706152f190dcba4518d9de2a80e05cc845e9","user":{"login":"CloudNiner","id":1818302,"avatar_url":"https://avatars.githubusercontent.com/u/1818302?v=3","gravatar_id":"","url":"https://api.github.com/users/CloudNiner","html_url":"https://github.com/CloudNiner","followers_url":"https://api.github.com/users/CloudNiner/followers","following_url":"https://api.github.com/users/CloudNiner/following{/other_user}","gists_url":"https://api.github.com/users/CloudNiner/gists{/gist_id}","starred_url":"https://api.github.com/users/CloudNiner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CloudNiner/subscriptions","organizations_url":"https://api.github.com/users/CloudNiner/orgs","repos_url":"https://api.github.com/users/CloudNiner/repos","events_url":"https://api.github.com/users/CloudNiner/events{/privacy}","received_events_url":"https://api.github.com/users/CloudNiner/received_events","type":"User","site_admin":false},"body":"Ah. Nice.","created_at":"2015-01-26T16:55:10Z","updated_at":"2015-01-26T16:55:10Z","html_url":"https://github.com/azavea/cac-tripplanner/pull/32#discussion_r23544769","pull_request_url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/32","_links":{"self":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/comments/23544769"},"html":{"href":"https://github.com/azavea/cac-tripplanner/pull/32#discussion_r23544769"},"pull_request":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/32","id":28035264,"html_url":"https://github.com/azavea/cac-tripplanner/pull/32","diff_url":"https://github.com/azavea/cac-tripplanner/pull/32.diff","patch_url":"https://github.com/azavea/cac-tripplanner/pull/32.patch","issue_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues/32","number":32,"state":"open","locked":false,"title":"Feature/routing ui","user":{"login":"moradology","id":1977405,"avatar_url":"https://avatars.githubusercontent.com/u/1977405?v=3","gravatar_id":"","url":"https://api.github.com/users/moradology","html_url":"https://github.com/moradology","followers_url":"https://api.github.com/users/moradology/followers","following_url":"https://api.github.com/users/moradology/following{/other_user}","gists_url":"https://api.github.com/users/moradology/gists{/gist_id}","starred_url":"https://api.github.com/users/moradology/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moradology/subscriptions","organizations_url":"https://api.github.com/users/moradology/orgs","repos_url":"https://api.github.com/users/moradology/repos","events_url":"https://api.github.com/users/moradology/events{/privacy}","received_events_url":"https://api.github.com/users/moradology/received_events","type":"User","site_admin":false},"body":"This changeset organizes scripts into folders, sets up a simple interface to OTP's planning endpoint, creates some logic for handling mode selection (and persistence through a session should we desire that), and adds some mock data on which plans might be calculated.\r\nAlso: it sets up the geolocation API to watch user location changes.","created_at":"2015-01-26T15:40:58Z","updated_at":"2015-01-26T16:55:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"86a9d92b15f9b56b2c8be713858029e5902edae6","assignee":{"login":"CloudNiner","id":1818302,"avatar_url":"https://avatars.githubusercontent.com/u/1818302?v=3","gravatar_id":"","url":"https://api.github.com/users/CloudNiner","html_url":"https://github.com/CloudNiner","followers_url":"https://api.github.com/users/CloudNiner/followers","following_url":"https://api.github.com/users/CloudNiner/following{/other_user}","gists_url":"https://api.github.com/users/CloudNiner/gists{/gist_id}","starred_url":"https://api.github.com/users/CloudNiner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CloudNiner/subscriptions","organizations_url":"https://api.github.com/users/CloudNiner/orgs","repos_url":"https://api.github.com/users/CloudNiner/repos","events_url":"https://api.github.com/users/CloudNiner/events{/privacy}","received_events_url":"https://api.github.com/users/CloudNiner/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/32/commits","review_comments_url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/32/comments","review_comment_url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/comments/{number}","comments_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues/32/comments","statuses_url":"https://api.github.com/repos/azavea/cac-tripplanner/statuses/2472706152f190dcba4518d9de2a80e05cc845e9","head":{"label":"azavea:feature/routing-ui","ref":"feature/routing-ui","sha":"2472706152f190dcba4518d9de2a80e05cc845e9","user":{"login":"azavea","id":595231,"avatar_url":"https://avatars.githubusercontent.com/u/595231?v=3","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"repo":{"id":27089530,"name":"cac-tripplanner","full_name":"azavea/cac-tripplanner","owner":{"login":"azavea","id":595231,"avatar_url":"https://avatars.githubusercontent.com/u/595231?v=3","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/azavea/cac-tripplanner","description":"","fork":false,"url":"https://api.github.com/repos/azavea/cac-tripplanner","forks_url":"https://api.github.com/repos/azavea/cac-tripplanner/forks","keys_url":"https://api.github.com/repos/azavea/cac-tripplanner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azavea/cac-tripplanner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azavea/cac-tripplanner/teams","hooks_url":"https://api.github.com/repos/azavea/cac-tripplanner/hooks","issue_events_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues/events{/number}","events_url":"https://api.github.com/repos/azavea/cac-tripplanner/events","assignees_url":"https://api.github.com/repos/azavea/cac-tripplanner/assignees{/user}","branches_url":"https://api.github.com/repos/azavea/cac-tripplanner/branches{/branch}","tags_url":"https://api.github.com/repos/azavea/cac-tripplanner/tags","blobs_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/refs{/sha}","trees_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azavea/cac-tripplanner/statuses/{sha}","languages_url":"https://api.github.com/repos/azavea/cac-tripplanner/languages","stargazers_url":"https://api.github.com/repos/azavea/cac-tripplanner/stargazers","contributors_url":"https://api.github.com/repos/azavea/cac-tripplanner/contributors","subscribers_url":"https://api.github.com/repos/azavea/cac-tripplanner/subscribers","subscription_url":"https://api.github.com/repos/azavea/cac-tripplanner/subscription","commits_url":"https://api.github.com/repos/azavea/cac-tripplanner/commits{/sha}","git_commits_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/commits{/sha}","comments_url":"https://api.github.com/repos/azavea/cac-tripplanner/comments{/number}","issue_comment_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues/comments/{number}","contents_url":"https://api.github.com/repos/azavea/cac-tripplanner/contents/{+path}","compare_url":"https://api.github.com/repos/azavea/cac-tripplanner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azavea/cac-tripplanner/merges","archive_url":"https://api.github.com/repos/azavea/cac-tripplanner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azavea/cac-tripplanner/downloads","issues_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues{/number}","pulls_url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls{/number}","milestones_url":"https://api.github.com/repos/azavea/cac-tripplanner/milestones{/number}","notifications_url":"https://api.github.com/repos/azavea/cac-tripplanner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azavea/cac-tripplanner/labels{/name}","releases_url":"https://api.github.com/repos/azavea/cac-tripplanner/releases{/id}","created_at":"2014-11-24T18:46:16Z","updated_at":"2015-01-26T16:36:01Z","pushed_at":"2015-01-26T16:36:01Z","git_url":"git://github.com/azavea/cac-tripplanner.git","ssh_url":"git@github.com:azavea/cac-tripplanner.git","clone_url":"https://github.com/azavea/cac-tripplanner.git","svn_url":"https://github.com/azavea/cac-tripplanner","homepage":null,"size":1075,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"develop"}},"base":{"label":"azavea:develop","ref":"develop","sha":"e8843777a486d44067853f4354f9f45596c04ae0","user":{"login":"azavea","id":595231,"avatar_url":"https://avatars.githubusercontent.com/u/595231?v=3","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"repo":{"id":27089530,"name":"cac-tripplanner","full_name":"azavea/cac-tripplanner","owner":{"login":"azavea","id":595231,"avatar_url":"https://avatars.githubusercontent.com/u/595231?v=3","gravatar_id":"","url":"https://api.github.com/users/azavea","html_url":"https://github.com/azavea","followers_url":"https://api.github.com/users/azavea/followers","following_url":"https://api.github.com/users/azavea/following{/other_user}","gists_url":"https://api.github.com/users/azavea/gists{/gist_id}","starred_url":"https://api.github.com/users/azavea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azavea/subscriptions","organizations_url":"https://api.github.com/users/azavea/orgs","repos_url":"https://api.github.com/users/azavea/repos","events_url":"https://api.github.com/users/azavea/events{/privacy}","received_events_url":"https://api.github.com/users/azavea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/azavea/cac-tripplanner","description":"","fork":false,"url":"https://api.github.com/repos/azavea/cac-tripplanner","forks_url":"https://api.github.com/repos/azavea/cac-tripplanner/forks","keys_url":"https://api.github.com/repos/azavea/cac-tripplanner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azavea/cac-tripplanner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azavea/cac-tripplanner/teams","hooks_url":"https://api.github.com/repos/azavea/cac-tripplanner/hooks","issue_events_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues/events{/number}","events_url":"https://api.github.com/repos/azavea/cac-tripplanner/events","assignees_url":"https://api.github.com/repos/azavea/cac-tripplanner/assignees{/user}","branches_url":"https://api.github.com/repos/azavea/cac-tripplanner/branches{/branch}","tags_url":"https://api.github.com/repos/azavea/cac-tripplanner/tags","blobs_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/refs{/sha}","trees_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azavea/cac-tripplanner/statuses/{sha}","languages_url":"https://api.github.com/repos/azavea/cac-tripplanner/languages","stargazers_url":"https://api.github.com/repos/azavea/cac-tripplanner/stargazers","contributors_url":"https://api.github.com/repos/azavea/cac-tripplanner/contributors","subscribers_url":"https://api.github.com/repos/azavea/cac-tripplanner/subscribers","subscription_url":"https://api.github.com/repos/azavea/cac-tripplanner/subscription","commits_url":"https://api.github.com/repos/azavea/cac-tripplanner/commits{/sha}","git_commits_url":"https://api.github.com/repos/azavea/cac-tripplanner/git/commits{/sha}","comments_url":"https://api.github.com/repos/azavea/cac-tripplanner/comments{/number}","issue_comment_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues/comments/{number}","contents_url":"https://api.github.com/repos/azavea/cac-tripplanner/contents/{+path}","compare_url":"https://api.github.com/repos/azavea/cac-tripplanner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azavea/cac-tripplanner/merges","archive_url":"https://api.github.com/repos/azavea/cac-tripplanner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azavea/cac-tripplanner/downloads","issues_url":"https://api.github.com/repos/azavea/cac-tripplanner/issues{/number}","pulls_url":"https://api.github.com/repos/azavea/cac-tripplanner/pulls{/number}","milestones_url":"https://api.github.com/repos/azavea/cac-tripplanner/milestones{/number}","notifications_url":"https://api.github.com/repos/azavea/cac-tripplanner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azavea/cac-tripplanner/labels{/name}","releases_url":"https://api.github.com/repos/azavea/cac-tripplanner/releases{/id}","created_at":"2014-11-24T18:46:16Z","updated_at":"2015-01-26T16:36:01Z","pushed_at":"2015-01-26T16:36:01Z","git_url":"git://github.com/azavea/cac-tripplanner.git","ssh_url":"git@github.com:azavea/cac-tripplanner.git","clone_url":"https://github.com/azavea/cac-tripplanner.git","svn_url":"https://github.com/azavea/cac-tripplanner","homepage":null,"size":1075,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/32"},"html":{"href":"https://github.com/azavea/cac-tripplanner/pull/32"},"issue":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/issues/32"},"comments":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/azavea/cac-tripplanner/statuses/2472706152f190dcba4518d9de2a80e05cc845e9"}}}}