{"action":"created","comment":{"url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls/comments/35475298","id":35475298,"diff_hunk":"@@ -79,37 +93,42 @@ def on_body(data)\n       c.access_token = @oauth_token\n       c.access_token_secret = @oauth_token_secret.value\n     end\n+\n+    @rest = Twitter::REST::Client.new do |c|\n+      c.consumer_key = @consumer_key\n+      c.consumer_secret = @consumer_secret.value\n+      c.access_token = @oauth_token\n+      c.access_token_secret = @oauth_token_secret.value\n+    end\n   end\n \n   public\n   def run(queue)\n     @logger.info(\"Starting twitter tracking\", :keywords => @keywords)\n     begin\n-      @client.filter(:track => @keywords.join(\",\")) do |tweet|\n-        if tweet.is_a?(Twitter::Tweet)\n-          @logger.debug? && @logger.debug(\"Got tweet\", :user => tweet.user.screen_name, :text => tweet.text)\n-          if @full_tweet\n-            event = LogStash::Event.new(LogStash::Util.stringify_symbols(tweet.to_hash))\n-            event.timestamp = LogStash::Timestamp.new(tweet.created_at)\n-          else\n-            event = LogStash::Event.new(\n-              LogStash::Event::TIMESTAMP => LogStash::Timestamp.new(tweet.created_at),\n-              \"message\" => tweet.full_text,\n-              \"user\" => tweet.user.screen_name,\n-              \"client\" => tweet.source,\n-              \"retweeted\" => tweet.retweeted?,\n-              \"source\" => \"http://twitter.com/#{tweet.user.screen_name}/status/#{tweet.id}\"\n-            )\n-            event[\"in-reply-to\"] = tweet.in_reply_to_status_id if tweet.reply?\n-            unless tweet.urls.empty?\n-              event[\"urls\"] = tweet.urls.map(&:expanded_url).map(&:to_s)\n-            end\n-          end\n-\n-          decorate(event)\n-          queue << event\n+      options = {}\n+      if @keywords.length > 0\n+        options[:track] = @keywords.join(\",\")\n+      end\n+      if @locations.length > 0\n+        options[:locations] = @locations.join(\",\")\n+      end\n+      if @follows.length > 0\n+        ids = @follows.map { |user| get_user_id( user) }.compact\n+        ids =  ids.keep_if { |v| not v.nil? }.join(',')\n+        if ids != ''\n+          options[:follow] =  ids\n         end\n-      end # client.filter\n+      end\n+\n+      if options.empty?\n+        @logger.debug? && @logger.debug(\"Listening on the firehose\")","path":"lib/logstash/inputs/twitter.rb","position":81,"original_position":81,"commit_id":"fdb376d894c170afd9375559bd7639d0eb94038c","original_commit_id":"fdb376d894c170afd9375559bd7639d0eb94038c","user":{"login":"jordansissel","id":131818,"avatar_url":"https://avatars.githubusercontent.com/u/131818?v=3","gravatar_id":"","url":"https://api.github.com/users/jordansissel","html_url":"https://github.com/jordansissel","followers_url":"https://api.github.com/users/jordansissel/followers","following_url":"https://api.github.com/users/jordansissel/following{/other_user}","gists_url":"https://api.github.com/users/jordansissel/gists{/gist_id}","starred_url":"https://api.github.com/users/jordansissel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordansissel/subscriptions","organizations_url":"https://api.github.com/users/jordansissel/orgs","repos_url":"https://api.github.com/users/jordansissel/repos","events_url":"https://api.github.com/users/jordansissel/events{/privacy}","received_events_url":"https://api.github.com/users/jordansissel/received_events","type":"User","site_admin":false},"body":"I also don't have firehose access, so it's difficult for me to verify this beyond just reading the code.","created_at":"2015-07-24T23:42:29Z","updated_at":"2015-07-24T23:42:29Z","html_url":"https://github.com/logstash-plugins/logstash-input-twitter/pull/12#discussion_r35475298","pull_request_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls/comments/35475298"},"html":{"href":"https://github.com/logstash-plugins/logstash-input-twitter/pull/12#discussion_r35475298"},"pull_request":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls/12","id":34056829,"html_url":"https://github.com/logstash-plugins/logstash-input-twitter/pull/12","diff_url":"https://github.com/logstash-plugins/logstash-input-twitter/pull/12.diff","patch_url":"https://github.com/logstash-plugins/logstash-input-twitter/pull/12.patch","issue_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/issues/12","number":12,"state":"open","locked":false,"title":"add ability to filter tweets on location and follow","user":{"login":"friedmans","id":11222302,"avatar_url":"https://avatars.githubusercontent.com/u/11222302?v=3","gravatar_id":"","url":"https://api.github.com/users/friedmans","html_url":"https://github.com/friedmans","followers_url":"https://api.github.com/users/friedmans/followers","following_url":"https://api.github.com/users/friedmans/following{/other_user}","gists_url":"https://api.github.com/users/friedmans/gists{/gist_id}","starred_url":"https://api.github.com/users/friedmans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/friedmans/subscriptions","organizations_url":"https://api.github.com/users/friedmans/orgs","repos_url":"https://api.github.com/users/friedmans/repos","events_url":"https://api.github.com/users/friedmans/events{/privacy}","received_events_url":"https://api.github.com/users/friedmans/received_events","type":"User","site_admin":false},"body":"This patch exposes the locations and follow keywords to the search parameter of the underlying twitter API.","created_at":"2015-04-24T15:06:44Z","updated_at":"2015-07-24T23:42:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e843d8ed86d2c91ec1d85f7e1e5f6dd56323ec3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls/12/commits","review_comments_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls/12/comments","review_comment_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/issues/12/comments","statuses_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/statuses/fdb376d894c170afd9375559bd7639d0eb94038c","head":{"label":"friedmans:add_params","ref":"add_params","sha":"fdb376d894c170afd9375559bd7639d0eb94038c","user":{"login":"friedmans","id":11222302,"avatar_url":"https://avatars.githubusercontent.com/u/11222302?v=3","gravatar_id":"","url":"https://api.github.com/users/friedmans","html_url":"https://github.com/friedmans","followers_url":"https://api.github.com/users/friedmans/followers","following_url":"https://api.github.com/users/friedmans/following{/other_user}","gists_url":"https://api.github.com/users/friedmans/gists{/gist_id}","starred_url":"https://api.github.com/users/friedmans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/friedmans/subscriptions","organizations_url":"https://api.github.com/users/friedmans/orgs","repos_url":"https://api.github.com/users/friedmans/repos","events_url":"https://api.github.com/users/friedmans/events{/privacy}","received_events_url":"https://api.github.com/users/friedmans/received_events","type":"User","site_admin":false},"repo":{"id":33624292,"name":"logstash-input-twitter","full_name":"friedmans/logstash-input-twitter","owner":{"login":"friedmans","id":11222302,"avatar_url":"https://avatars.githubusercontent.com/u/11222302?v=3","gravatar_id":"","url":"https://api.github.com/users/friedmans","html_url":"https://github.com/friedmans","followers_url":"https://api.github.com/users/friedmans/followers","following_url":"https://api.github.com/users/friedmans/following{/other_user}","gists_url":"https://api.github.com/users/friedmans/gists{/gist_id}","starred_url":"https://api.github.com/users/friedmans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/friedmans/subscriptions","organizations_url":"https://api.github.com/users/friedmans/orgs","repos_url":"https://api.github.com/users/friedmans/repos","events_url":"https://api.github.com/users/friedmans/events{/privacy}","received_events_url":"https://api.github.com/users/friedmans/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/friedmans/logstash-input-twitter","description":null,"fork":true,"url":"https://api.github.com/repos/friedmans/logstash-input-twitter","forks_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/forks","keys_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/teams","hooks_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/hooks","issue_events_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/issues/events{/number}","events_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/events","assignees_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/assignees{/user}","branches_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/branches{/branch}","tags_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/tags","blobs_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/git/refs{/sha}","trees_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/statuses/{sha}","languages_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/languages","stargazers_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/stargazers","contributors_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/contributors","subscribers_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/subscribers","subscription_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/subscription","commits_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/commits{/sha}","git_commits_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/git/commits{/sha}","comments_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/comments{/number}","issue_comment_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/issues/comments{/number}","contents_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/contents/{+path}","compare_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/merges","archive_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/downloads","issues_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/issues{/number}","pulls_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/pulls{/number}","milestones_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/milestones{/number}","notifications_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/labels{/name}","releases_url":"https://api.github.com/repos/friedmans/logstash-input-twitter/releases{/id}","created_at":"2015-04-08T18:22:23Z","updated_at":"2015-04-24T15:03:02Z","pushed_at":"2015-05-18T14:42:45Z","git_url":"git://github.com/friedmans/logstash-input-twitter.git","ssh_url":"git@github.com:friedmans/logstash-input-twitter.git","clone_url":"https://github.com/friedmans/logstash-input-twitter.git","svn_url":"https://github.com/friedmans/logstash-input-twitter","homepage":null,"size":132,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"logstash-plugins:master","ref":"master","sha":"f49895eb6d85b93ef5daa4b07523f2b4e5b5dada","user":{"login":"logstash-plugins","id":8961934,"avatar_url":"https://avatars.githubusercontent.com/u/8961934?v=3","gravatar_id":"","url":"https://api.github.com/users/logstash-plugins","html_url":"https://github.com/logstash-plugins","followers_url":"https://api.github.com/users/logstash-plugins/followers","following_url":"https://api.github.com/users/logstash-plugins/following{/other_user}","gists_url":"https://api.github.com/users/logstash-plugins/gists{/gist_id}","starred_url":"https://api.github.com/users/logstash-plugins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/logstash-plugins/subscriptions","organizations_url":"https://api.github.com/users/logstash-plugins/orgs","repos_url":"https://api.github.com/users/logstash-plugins/repos","events_url":"https://api.github.com/users/logstash-plugins/events{/privacy}","received_events_url":"https://api.github.com/users/logstash-plugins/received_events","type":"Organization","site_admin":false},"repo":{"id":25312508,"name":"logstash-input-twitter","full_name":"logstash-plugins/logstash-input-twitter","owner":{"login":"logstash-plugins","id":8961934,"avatar_url":"https://avatars.githubusercontent.com/u/8961934?v=3","gravatar_id":"","url":"https://api.github.com/users/logstash-plugins","html_url":"https://github.com/logstash-plugins","followers_url":"https://api.github.com/users/logstash-plugins/followers","following_url":"https://api.github.com/users/logstash-plugins/following{/other_user}","gists_url":"https://api.github.com/users/logstash-plugins/gists{/gist_id}","starred_url":"https://api.github.com/users/logstash-plugins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/logstash-plugins/subscriptions","organizations_url":"https://api.github.com/users/logstash-plugins/orgs","repos_url":"https://api.github.com/users/logstash-plugins/repos","events_url":"https://api.github.com/users/logstash-plugins/events{/privacy}","received_events_url":"https://api.github.com/users/logstash-plugins/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/logstash-plugins/logstash-input-twitter","description":null,"fork":false,"url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter","forks_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/forks","keys_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/teams","hooks_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/hooks","issue_events_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/issues/events{/number}","events_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/events","assignees_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/assignees{/user}","branches_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/branches{/branch}","tags_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/tags","blobs_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/git/refs{/sha}","trees_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/statuses/{sha}","languages_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/languages","stargazers_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/stargazers","contributors_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/contributors","subscribers_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/subscribers","subscription_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/subscription","commits_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/commits{/sha}","git_commits_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/git/commits{/sha}","comments_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/comments{/number}","issue_comment_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/issues/comments{/number}","contents_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/contents/{+path}","compare_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/merges","archive_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/downloads","issues_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/issues{/number}","pulls_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls{/number}","milestones_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/milestones{/number}","notifications_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/labels{/name}","releases_url":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/releases{/id}","created_at":"2014-10-16T17:03:50Z","updated_at":"2015-07-17T08:50:48Z","pushed_at":"2015-06-29T18:08:49Z","git_url":"git://github.com/logstash-plugins/logstash-input-twitter.git","ssh_url":"git@github.com:logstash-plugins/logstash-input-twitter.git","clone_url":"https://github.com/logstash-plugins/logstash-input-twitter.git","svn_url":"https://github.com/logstash-plugins/logstash-input-twitter","homepage":null,"size":270,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":17,"forks":7,"open_issues":17,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls/12"},"html":{"href":"https://github.com/logstash-plugins/logstash-input-twitter/pull/12"},"issue":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/issues/12"},"comments":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/logstash-plugins/logstash-input-twitter/statuses/fdb376d894c170afd9375559bd7639d0eb94038c"}}}}