{"action":"created","comment":{"url":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls/comments/43110216","id":43110216,"diff_hunk":"@@ -0,0 +1,48 @@\n+class LinksController < ApplicationController\n+  \n+  def show\n+    @link = Link.find_by_short_url(params[:short_url])\n+  \n+    if redirect_to @link.given_url, status: 301\n+      @link.popularity_score += 1\n+      @link.save\n+    end\n+  end\n+  \n+  def create\n+    url = prepend_protocol_if_missing(params[:link][:given_url])\n+    is_existing_link = Link.find_by_given_url(url)\n+    \n+    if is_existing_link\n+      flash_and_redirect(:existing_link, is_existing_link.short_url, preview_path)\n+    else ","path":"app/controllers/links_controller.rb","position":18,"original_position":18,"commit_id":"bf22a6d9e1f8c1bec1d9027be6d05cb61434d9cd","original_commit_id":"bf22a6d9e1f8c1bec1d9027be6d05cb61434d9cd","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Trailing whitespace detected.","created_at":"2015-10-27T11:35:20Z","updated_at":"2015-10-27T11:35:20Z","html_url":"https://github.com/andela-cdaniel/xtrim/pull/3#discussion_r43110216","pull_request_url":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls/comments/43110216"},"html":{"href":"https://github.com/andela-cdaniel/xtrim/pull/3#discussion_r43110216"},"pull_request":{"href":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls/3","id":48858869,"html_url":"https://github.com/andela-cdaniel/xtrim/pull/3","diff_url":"https://github.com/andela-cdaniel/xtrim/pull/3.diff","patch_url":"https://github.com/andela-cdaniel/xtrim/pull/3.patch","issue_url":"https://api.github.com/repos/andela-cdaniel/xtrim/issues/3","number":3,"state":"open","locked":false,"title":"Feature/homepage","user":{"login":"andela-cdaniel","id":7131935,"avatar_url":"https://avatars.githubusercontent.com/u/7131935?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-cdaniel","html_url":"https://github.com/andela-cdaniel","followers_url":"https://api.github.com/users/andela-cdaniel/followers","following_url":"https://api.github.com/users/andela-cdaniel/following{/other_user}","gists_url":"https://api.github.com/users/andela-cdaniel/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-cdaniel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-cdaniel/subscriptions","organizations_url":"https://api.github.com/users/andela-cdaniel/orgs","repos_url":"https://api.github.com/users/andela-cdaniel/repos","events_url":"https://api.github.com/users/andela-cdaniel/events{/privacy}","received_events_url":"https://api.github.com/users/andela-cdaniel/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-27T11:35:08Z","updated_at":"2015-10-27T11:35:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"58c92169481d733efe9ac0819f600cc481b11523","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls/3/commits","review_comments_url":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls/3/comments","review_comment_url":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela-cdaniel/xtrim/issues/3/comments","statuses_url":"https://api.github.com/repos/andela-cdaniel/xtrim/statuses/bf22a6d9e1f8c1bec1d9027be6d05cb61434d9cd","head":{"label":"andela-cdaniel:feature/homepage","ref":"feature/homepage","sha":"bf22a6d9e1f8c1bec1d9027be6d05cb61434d9cd","user":{"login":"andela-cdaniel","id":7131935,"avatar_url":"https://avatars.githubusercontent.com/u/7131935?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-cdaniel","html_url":"https://github.com/andela-cdaniel","followers_url":"https://api.github.com/users/andela-cdaniel/followers","following_url":"https://api.github.com/users/andela-cdaniel/following{/other_user}","gists_url":"https://api.github.com/users/andela-cdaniel/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-cdaniel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-cdaniel/subscriptions","organizations_url":"https://api.github.com/users/andela-cdaniel/orgs","repos_url":"https://api.github.com/users/andela-cdaniel/repos","events_url":"https://api.github.com/users/andela-cdaniel/events{/privacy}","received_events_url":"https://api.github.com/users/andela-cdaniel/received_events","type":"User","site_admin":false},"repo":{"id":44548183,"name":"xtrim","full_name":"andela-cdaniel/xtrim","owner":{"login":"andela-cdaniel","id":7131935,"avatar_url":"https://avatars.githubusercontent.com/u/7131935?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-cdaniel","html_url":"https://github.com/andela-cdaniel","followers_url":"https://api.github.com/users/andela-cdaniel/followers","following_url":"https://api.github.com/users/andela-cdaniel/following{/other_user}","gists_url":"https://api.github.com/users/andela-cdaniel/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-cdaniel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-cdaniel/subscriptions","organizations_url":"https://api.github.com/users/andela-cdaniel/orgs","repos_url":"https://api.github.com/users/andela-cdaniel/repos","events_url":"https://api.github.com/users/andela-cdaniel/events{/privacy}","received_events_url":"https://api.github.com/users/andela-cdaniel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-cdaniel/xtrim","description":"","fork":false,"url":"https://api.github.com/repos/andela-cdaniel/xtrim","forks_url":"https://api.github.com/repos/andela-cdaniel/xtrim/forks","keys_url":"https://api.github.com/repos/andela-cdaniel/xtrim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-cdaniel/xtrim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-cdaniel/xtrim/teams","hooks_url":"https://api.github.com/repos/andela-cdaniel/xtrim/hooks","issue_events_url":"https://api.github.com/repos/andela-cdaniel/xtrim/issues/events{/number}","events_url":"https://api.github.com/repos/andela-cdaniel/xtrim/events","assignees_url":"https://api.github.com/repos/andela-cdaniel/xtrim/assignees{/user}","branches_url":"https://api.github.com/repos/andela-cdaniel/xtrim/branches{/branch}","tags_url":"https://api.github.com/repos/andela-cdaniel/xtrim/tags","blobs_url":"https://api.github.com/repos/andela-cdaniel/xtrim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-cdaniel/xtrim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-cdaniel/xtrim/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-cdaniel/xtrim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-cdaniel/xtrim/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-cdaniel/xtrim/languages","stargazers_url":"https://api.github.com/repos/andela-cdaniel/xtrim/stargazers","contributors_url":"https://api.github.com/repos/andela-cdaniel/xtrim/contributors","subscribers_url":"https://api.github.com/repos/andela-cdaniel/xtrim/subscribers","subscription_url":"https://api.github.com/repos/andela-cdaniel/xtrim/subscription","commits_url":"https://api.github.com/repos/andela-cdaniel/xtrim/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-cdaniel/xtrim/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-cdaniel/xtrim/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-cdaniel/xtrim/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-cdaniel/xtrim/contents/{+path}","compare_url":"https://api.github.com/repos/andela-cdaniel/xtrim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-cdaniel/xtrim/merges","archive_url":"https://api.github.com/repos/andela-cdaniel/xtrim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-cdaniel/xtrim/downloads","issues_url":"https://api.github.com/repos/andela-cdaniel/xtrim/issues{/number}","pulls_url":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-cdaniel/xtrim/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-cdaniel/xtrim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-cdaniel/xtrim/labels{/name}","releases_url":"https://api.github.com/repos/andela-cdaniel/xtrim/releases{/id}","created_at":"2015-10-19T16:27:01Z","updated_at":"2015-10-23T12:26:16Z","pushed_at":"2015-10-27T11:35:08Z","git_url":"git://github.com/andela-cdaniel/xtrim.git","ssh_url":"git@github.com:andela-cdaniel/xtrim.git","clone_url":"https://github.com/andela-cdaniel/xtrim.git","svn_url":"https://github.com/andela-cdaniel/xtrim","homepage":null,"size":17620,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"andela-cdaniel:master","ref":"master","sha":"890ec84a3ca090fff419d1489663c5cdf117742a","user":{"login":"andela-cdaniel","id":7131935,"avatar_url":"https://avatars.githubusercontent.com/u/7131935?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-cdaniel","html_url":"https://github.com/andela-cdaniel","followers_url":"https://api.github.com/users/andela-cdaniel/followers","following_url":"https://api.github.com/users/andela-cdaniel/following{/other_user}","gists_url":"https://api.github.com/users/andela-cdaniel/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-cdaniel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-cdaniel/subscriptions","organizations_url":"https://api.github.com/users/andela-cdaniel/orgs","repos_url":"https://api.github.com/users/andela-cdaniel/repos","events_url":"https://api.github.com/users/andela-cdaniel/events{/privacy}","received_events_url":"https://api.github.com/users/andela-cdaniel/received_events","type":"User","site_admin":false},"repo":{"id":44548183,"name":"xtrim","full_name":"andela-cdaniel/xtrim","owner":{"login":"andela-cdaniel","id":7131935,"avatar_url":"https://avatars.githubusercontent.com/u/7131935?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-cdaniel","html_url":"https://github.com/andela-cdaniel","followers_url":"https://api.github.com/users/andela-cdaniel/followers","following_url":"https://api.github.com/users/andela-cdaniel/following{/other_user}","gists_url":"https://api.github.com/users/andela-cdaniel/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-cdaniel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-cdaniel/subscriptions","organizations_url":"https://api.github.com/users/andela-cdaniel/orgs","repos_url":"https://api.github.com/users/andela-cdaniel/repos","events_url":"https://api.github.com/users/andela-cdaniel/events{/privacy}","received_events_url":"https://api.github.com/users/andela-cdaniel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-cdaniel/xtrim","description":"","fork":false,"url":"https://api.github.com/repos/andela-cdaniel/xtrim","forks_url":"https://api.github.com/repos/andela-cdaniel/xtrim/forks","keys_url":"https://api.github.com/repos/andela-cdaniel/xtrim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-cdaniel/xtrim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-cdaniel/xtrim/teams","hooks_url":"https://api.github.com/repos/andela-cdaniel/xtrim/hooks","issue_events_url":"https://api.github.com/repos/andela-cdaniel/xtrim/issues/events{/number}","events_url":"https://api.github.com/repos/andela-cdaniel/xtrim/events","assignees_url":"https://api.github.com/repos/andela-cdaniel/xtrim/assignees{/user}","branches_url":"https://api.github.com/repos/andela-cdaniel/xtrim/branches{/branch}","tags_url":"https://api.github.com/repos/andela-cdaniel/xtrim/tags","blobs_url":"https://api.github.com/repos/andela-cdaniel/xtrim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-cdaniel/xtrim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-cdaniel/xtrim/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-cdaniel/xtrim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-cdaniel/xtrim/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-cdaniel/xtrim/languages","stargazers_url":"https://api.github.com/repos/andela-cdaniel/xtrim/stargazers","contributors_url":"https://api.github.com/repos/andela-cdaniel/xtrim/contributors","subscribers_url":"https://api.github.com/repos/andela-cdaniel/xtrim/subscribers","subscription_url":"https://api.github.com/repos/andela-cdaniel/xtrim/subscription","commits_url":"https://api.github.com/repos/andela-cdaniel/xtrim/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-cdaniel/xtrim/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-cdaniel/xtrim/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-cdaniel/xtrim/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-cdaniel/xtrim/contents/{+path}","compare_url":"https://api.github.com/repos/andela-cdaniel/xtrim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-cdaniel/xtrim/merges","archive_url":"https://api.github.com/repos/andela-cdaniel/xtrim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-cdaniel/xtrim/downloads","issues_url":"https://api.github.com/repos/andela-cdaniel/xtrim/issues{/number}","pulls_url":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-cdaniel/xtrim/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-cdaniel/xtrim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-cdaniel/xtrim/labels{/name}","releases_url":"https://api.github.com/repos/andela-cdaniel/xtrim/releases{/id}","created_at":"2015-10-19T16:27:01Z","updated_at":"2015-10-23T12:26:16Z","pushed_at":"2015-10-27T11:35:08Z","git_url":"git://github.com/andela-cdaniel/xtrim.git","ssh_url":"git@github.com:andela-cdaniel/xtrim.git","clone_url":"https://github.com/andela-cdaniel/xtrim.git","svn_url":"https://github.com/andela-cdaniel/xtrim","homepage":null,"size":17620,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls/3"},"html":{"href":"https://github.com/andela-cdaniel/xtrim/pull/3"},"issue":{"href":"https://api.github.com/repos/andela-cdaniel/xtrim/issues/3"},"comments":{"href":"https://api.github.com/repos/andela-cdaniel/xtrim/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela-cdaniel/xtrim/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/andela-cdaniel/xtrim/statuses/bf22a6d9e1f8c1bec1d9027be6d05cb61434d9cd"}}}}