{"action":"created","comment":{"url":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls/comments/41316028","id":41316028,"diff_hunk":"@@ -7,12 +7,42 @@ def index\n       config.access_token        = ENV[\"TWITTER_ACCESS_TOKEN\"]\n       config.access_token_secret = ENV[\"TWITTER_ACCESS_SECRET\"]\n     end\n-    query = params[:search]\n-    @tweets = client.search(\"##{query}\").take(10)\n \n-    if current_user\n-      Search.create(query: params[:search], trend_or_location: true, user: current_user)\n+    if params[:search]\n+      query = params[:search]\n+      @tweets = client.search(\"##{query}\").take(25)\n+\n+      if current_user\n+        Search.create(query: params[:search], trend_or_location: \"Trend\", user: current_user)\n+      end\n+\n+    elsif params[:local]\n+      ip_address = request.remote_ip unless Rails.env.test? || Rails.env.development?\n+        ip_address = \"50.241.127.209\" if Rails.env.test? || Rails.env.development?\n+      location = GeoIP.new('GeoLiteCity.dat').city(ip_address)\n+      q = \"geocode:#{location.latitude},#{location.longitude},1mi\"\n+      @tweets = client.search(q).take(25)\n+\n+      if current_user\n+        Search.create(query: location.real_region_name, trend_or_location: \"Location\", user: current_user)\n+      end\n+\n+    elsif params[:location]\n+      location = params[:location]\n+      query = HTTParty.get(\"https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{ENV[\"GOOGLE_GEOCODING\"]}\")","path":"app/controllers/tweets_controller.rb","position":30,"original_position":30,"commit_id":"6cd75a27097e45212e25d4b70936b9554ab4f9b6","original_commit_id":"6cd75a27097e45212e25d4b70936b9554ab4f9b6","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":"Line is too long. [130/80]<br>Prefer single-quoted strings inside interpolations.","created_at":"2015-10-06T20:17:51Z","updated_at":"2015-10-06T20:17:51Z","html_url":"https://github.com/nathanielltaylor/trend-map/pull/1#discussion_r41316028","pull_request_url":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls/comments/41316028"},"html":{"href":"https://github.com/nathanielltaylor/trend-map/pull/1#discussion_r41316028"},"pull_request":{"href":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls/1","id":46952146,"html_url":"https://github.com/nathanielltaylor/trend-map/pull/1","diff_url":"https://github.com/nathanielltaylor/trend-map/pull/1.diff","patch_url":"https://github.com/nathanielltaylor/trend-map/pull/1.patch","issue_url":"https://api.github.com/repos/nathanielltaylor/trend-map/issues/1","number":1,"state":"open","locked":false,"title":"Location","user":{"login":"nathanielltaylor","id":12632655,"avatar_url":"https://avatars.githubusercontent.com/u/12632655?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanielltaylor","html_url":"https://github.com/nathanielltaylor","followers_url":"https://api.github.com/users/nathanielltaylor/followers","following_url":"https://api.github.com/users/nathanielltaylor/following{/other_user}","gists_url":"https://api.github.com/users/nathanielltaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanielltaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanielltaylor/subscriptions","organizations_url":"https://api.github.com/users/nathanielltaylor/orgs","repos_url":"https://api.github.com/users/nathanielltaylor/repos","events_url":"https://api.github.com/users/nathanielltaylor/events{/privacy}","received_events_url":"https://api.github.com/users/nathanielltaylor/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-06T20:17:43Z","updated_at":"2015-10-06T20:17:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"72bb9fcfb1b6301a3faaf468a6d9c821279432b9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls/1/commits","review_comments_url":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls/1/comments","review_comment_url":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nathanielltaylor/trend-map/issues/1/comments","statuses_url":"https://api.github.com/repos/nathanielltaylor/trend-map/statuses/6cd75a27097e45212e25d4b70936b9554ab4f9b6","head":{"label":"nathanielltaylor:location","ref":"location","sha":"6cd75a27097e45212e25d4b70936b9554ab4f9b6","user":{"login":"nathanielltaylor","id":12632655,"avatar_url":"https://avatars.githubusercontent.com/u/12632655?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanielltaylor","html_url":"https://github.com/nathanielltaylor","followers_url":"https://api.github.com/users/nathanielltaylor/followers","following_url":"https://api.github.com/users/nathanielltaylor/following{/other_user}","gists_url":"https://api.github.com/users/nathanielltaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanielltaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanielltaylor/subscriptions","organizations_url":"https://api.github.com/users/nathanielltaylor/orgs","repos_url":"https://api.github.com/users/nathanielltaylor/repos","events_url":"https://api.github.com/users/nathanielltaylor/events{/privacy}","received_events_url":"https://api.github.com/users/nathanielltaylor/received_events","type":"User","site_admin":false},"repo":{"id":43225861,"name":"trend-map","full_name":"nathanielltaylor/trend-map","owner":{"login":"nathanielltaylor","id":12632655,"avatar_url":"https://avatars.githubusercontent.com/u/12632655?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanielltaylor","html_url":"https://github.com/nathanielltaylor","followers_url":"https://api.github.com/users/nathanielltaylor/followers","following_url":"https://api.github.com/users/nathanielltaylor/following{/other_user}","gists_url":"https://api.github.com/users/nathanielltaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanielltaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanielltaylor/subscriptions","organizations_url":"https://api.github.com/users/nathanielltaylor/orgs","repos_url":"https://api.github.com/users/nathanielltaylor/repos","events_url":"https://api.github.com/users/nathanielltaylor/events{/privacy}","received_events_url":"https://api.github.com/users/nathanielltaylor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nathanielltaylor/trend-map","description":"Mapping trending topics to their geographic locations","fork":false,"url":"https://api.github.com/repos/nathanielltaylor/trend-map","forks_url":"https://api.github.com/repos/nathanielltaylor/trend-map/forks","keys_url":"https://api.github.com/repos/nathanielltaylor/trend-map/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nathanielltaylor/trend-map/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nathanielltaylor/trend-map/teams","hooks_url":"https://api.github.com/repos/nathanielltaylor/trend-map/hooks","issue_events_url":"https://api.github.com/repos/nathanielltaylor/trend-map/issues/events{/number}","events_url":"https://api.github.com/repos/nathanielltaylor/trend-map/events","assignees_url":"https://api.github.com/repos/nathanielltaylor/trend-map/assignees{/user}","branches_url":"https://api.github.com/repos/nathanielltaylor/trend-map/branches{/branch}","tags_url":"https://api.github.com/repos/nathanielltaylor/trend-map/tags","blobs_url":"https://api.github.com/repos/nathanielltaylor/trend-map/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nathanielltaylor/trend-map/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nathanielltaylor/trend-map/git/refs{/sha}","trees_url":"https://api.github.com/repos/nathanielltaylor/trend-map/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nathanielltaylor/trend-map/statuses/{sha}","languages_url":"https://api.github.com/repos/nathanielltaylor/trend-map/languages","stargazers_url":"https://api.github.com/repos/nathanielltaylor/trend-map/stargazers","contributors_url":"https://api.github.com/repos/nathanielltaylor/trend-map/contributors","subscribers_url":"https://api.github.com/repos/nathanielltaylor/trend-map/subscribers","subscription_url":"https://api.github.com/repos/nathanielltaylor/trend-map/subscription","commits_url":"https://api.github.com/repos/nathanielltaylor/trend-map/commits{/sha}","git_commits_url":"https://api.github.com/repos/nathanielltaylor/trend-map/git/commits{/sha}","comments_url":"https://api.github.com/repos/nathanielltaylor/trend-map/comments{/number}","issue_comment_url":"https://api.github.com/repos/nathanielltaylor/trend-map/issues/comments{/number}","contents_url":"https://api.github.com/repos/nathanielltaylor/trend-map/contents/{+path}","compare_url":"https://api.github.com/repos/nathanielltaylor/trend-map/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nathanielltaylor/trend-map/merges","archive_url":"https://api.github.com/repos/nathanielltaylor/trend-map/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nathanielltaylor/trend-map/downloads","issues_url":"https://api.github.com/repos/nathanielltaylor/trend-map/issues{/number}","pulls_url":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls{/number}","milestones_url":"https://api.github.com/repos/nathanielltaylor/trend-map/milestones{/number}","notifications_url":"https://api.github.com/repos/nathanielltaylor/trend-map/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nathanielltaylor/trend-map/labels{/name}","releases_url":"https://api.github.com/repos/nathanielltaylor/trend-map/releases{/id}","created_at":"2015-09-26T22:42:21Z","updated_at":"2015-10-05T00:11:51Z","pushed_at":"2015-10-06T20:17:45Z","git_url":"git://github.com/nathanielltaylor/trend-map.git","ssh_url":"git@github.com:nathanielltaylor/trend-map.git","clone_url":"https://github.com/nathanielltaylor/trend-map.git","svn_url":"https://github.com/nathanielltaylor/trend-map","homepage":null,"size":172,"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":"nathanielltaylor:master","ref":"master","sha":"93b3aace2bbc2d6986f6868072246ddb183ad728","user":{"login":"nathanielltaylor","id":12632655,"avatar_url":"https://avatars.githubusercontent.com/u/12632655?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanielltaylor","html_url":"https://github.com/nathanielltaylor","followers_url":"https://api.github.com/users/nathanielltaylor/followers","following_url":"https://api.github.com/users/nathanielltaylor/following{/other_user}","gists_url":"https://api.github.com/users/nathanielltaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanielltaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanielltaylor/subscriptions","organizations_url":"https://api.github.com/users/nathanielltaylor/orgs","repos_url":"https://api.github.com/users/nathanielltaylor/repos","events_url":"https://api.github.com/users/nathanielltaylor/events{/privacy}","received_events_url":"https://api.github.com/users/nathanielltaylor/received_events","type":"User","site_admin":false},"repo":{"id":43225861,"name":"trend-map","full_name":"nathanielltaylor/trend-map","owner":{"login":"nathanielltaylor","id":12632655,"avatar_url":"https://avatars.githubusercontent.com/u/12632655?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanielltaylor","html_url":"https://github.com/nathanielltaylor","followers_url":"https://api.github.com/users/nathanielltaylor/followers","following_url":"https://api.github.com/users/nathanielltaylor/following{/other_user}","gists_url":"https://api.github.com/users/nathanielltaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanielltaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanielltaylor/subscriptions","organizations_url":"https://api.github.com/users/nathanielltaylor/orgs","repos_url":"https://api.github.com/users/nathanielltaylor/repos","events_url":"https://api.github.com/users/nathanielltaylor/events{/privacy}","received_events_url":"https://api.github.com/users/nathanielltaylor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nathanielltaylor/trend-map","description":"Mapping trending topics to their geographic locations","fork":false,"url":"https://api.github.com/repos/nathanielltaylor/trend-map","forks_url":"https://api.github.com/repos/nathanielltaylor/trend-map/forks","keys_url":"https://api.github.com/repos/nathanielltaylor/trend-map/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nathanielltaylor/trend-map/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nathanielltaylor/trend-map/teams","hooks_url":"https://api.github.com/repos/nathanielltaylor/trend-map/hooks","issue_events_url":"https://api.github.com/repos/nathanielltaylor/trend-map/issues/events{/number}","events_url":"https://api.github.com/repos/nathanielltaylor/trend-map/events","assignees_url":"https://api.github.com/repos/nathanielltaylor/trend-map/assignees{/user}","branches_url":"https://api.github.com/repos/nathanielltaylor/trend-map/branches{/branch}","tags_url":"https://api.github.com/repos/nathanielltaylor/trend-map/tags","blobs_url":"https://api.github.com/repos/nathanielltaylor/trend-map/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nathanielltaylor/trend-map/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nathanielltaylor/trend-map/git/refs{/sha}","trees_url":"https://api.github.com/repos/nathanielltaylor/trend-map/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nathanielltaylor/trend-map/statuses/{sha}","languages_url":"https://api.github.com/repos/nathanielltaylor/trend-map/languages","stargazers_url":"https://api.github.com/repos/nathanielltaylor/trend-map/stargazers","contributors_url":"https://api.github.com/repos/nathanielltaylor/trend-map/contributors","subscribers_url":"https://api.github.com/repos/nathanielltaylor/trend-map/subscribers","subscription_url":"https://api.github.com/repos/nathanielltaylor/trend-map/subscription","commits_url":"https://api.github.com/repos/nathanielltaylor/trend-map/commits{/sha}","git_commits_url":"https://api.github.com/repos/nathanielltaylor/trend-map/git/commits{/sha}","comments_url":"https://api.github.com/repos/nathanielltaylor/trend-map/comments{/number}","issue_comment_url":"https://api.github.com/repos/nathanielltaylor/trend-map/issues/comments{/number}","contents_url":"https://api.github.com/repos/nathanielltaylor/trend-map/contents/{+path}","compare_url":"https://api.github.com/repos/nathanielltaylor/trend-map/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nathanielltaylor/trend-map/merges","archive_url":"https://api.github.com/repos/nathanielltaylor/trend-map/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nathanielltaylor/trend-map/downloads","issues_url":"https://api.github.com/repos/nathanielltaylor/trend-map/issues{/number}","pulls_url":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls{/number}","milestones_url":"https://api.github.com/repos/nathanielltaylor/trend-map/milestones{/number}","notifications_url":"https://api.github.com/repos/nathanielltaylor/trend-map/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nathanielltaylor/trend-map/labels{/name}","releases_url":"https://api.github.com/repos/nathanielltaylor/trend-map/releases{/id}","created_at":"2015-09-26T22:42:21Z","updated_at":"2015-10-05T00:11:51Z","pushed_at":"2015-10-06T20:17:45Z","git_url":"git://github.com/nathanielltaylor/trend-map.git","ssh_url":"git@github.com:nathanielltaylor/trend-map.git","clone_url":"https://github.com/nathanielltaylor/trend-map.git","svn_url":"https://github.com/nathanielltaylor/trend-map","homepage":null,"size":172,"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/nathanielltaylor/trend-map/pulls/1"},"html":{"href":"https://github.com/nathanielltaylor/trend-map/pull/1"},"issue":{"href":"https://api.github.com/repos/nathanielltaylor/trend-map/issues/1"},"comments":{"href":"https://api.github.com/repos/nathanielltaylor/trend-map/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nathanielltaylor/trend-map/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/nathanielltaylor/trend-map/statuses/6cd75a27097e45212e25d4b70936b9554ab4f9b6"}}}}