logstash-input-twitter 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c922a98eed84cc4f486e62cf74ec0ccfe3877788503cc6de18cde82b7ce59d70
4
- data.tar.gz: db40a663d45c6fb8b395c6f12af58d57bccc08ab7e9fd8e534513defd6aef6cd
3
+ metadata.gz: '0857b97ff1503291374881bfd1dafe4693ba756b5a935e8331bc415e17d30148'
4
+ data.tar.gz: 62aeaf7b1e9161479df75e3fa34e9da1c1162c7d2ee50bf13818923a62bac740
5
5
  SHA512:
6
- metadata.gz: 4fd2bbfd624db48d8c572cd1faa8a4be34035093929b3ce663b5c38bd228fdbafcdf6b0de81c3c6af98299022795e380573451e93f92b8d3dc91db8f5869c5d6
7
- data.tar.gz: f215a53f05f8490ac7e612719095dc0ea53be10f38b984d48e29c30e2b75f1b300deeb412d64f03d8ea035058dafdc59741aad2f24f4e0700ff37efb325ebf6e
6
+ metadata.gz: 3758ab5554337990eddbaf5da5c7207be10252cbfe8132697b6809014f7bb0390d797d6ae2a0de4a38561e1ae0113fe4245dceae541e6fd51a3c87169f922acc
7
+ data.tar.gz: 6a3eed43e5128523ad319e4513d1bf0297382ad7f8671386579dae53d5e5f49a7ecb3f75f7ed80fdf1f68c8da0de52fa65bd307667d7d55ec9a33a5dbbff7e08
@@ -1,3 +1,6 @@
1
+ ## 4.0.1
2
+ - Updated Twitter gem to v6.2.0, cleaned up obsolete monkey patches, fixed integration tests [#63](https://github.com/logstash-plugins/logstash-input-twitter/pull/63)
3
+
1
4
  ## 4.0.0
2
5
  - Update http-form_data to ~> 2 and public_suffix to ~> 3
3
6
 
@@ -5,6 +5,7 @@ require "logstash/timestamp"
5
5
  require "logstash/util"
6
6
  require "logstash/json"
7
7
  require "stud/interval"
8
+ require "twitter"
8
9
  require "logstash/inputs/twitter/patches"
9
10
 
10
11
  # Ingest events from the Twitter Streaming API.
@@ -104,8 +105,6 @@ class LogStash::Inputs::Twitter < LogStash::Inputs::Base
104
105
  config :rate_limit_reset_in, :validate => :number, :default => 300
105
106
 
106
107
  def register
107
- require "twitter"
108
-
109
108
  if !@use_samples && ( @keywords.nil? && @follows.nil? && @locations.nil? )
110
109
  raise LogStash::ConfigurationError.new("At least one parameter (follows, locations or keywords) must be specified.")
111
110
  end
@@ -1,7 +1,5 @@
1
1
  # encoding: utf-8
2
- require 'twitter/streaming/connection'
3
2
  require 'twitter/streaming/response'
4
- require 'twitter/streaming/message_parser'
5
3
 
6
4
  module LogStash
7
5
  module Inputs
@@ -10,54 +8,12 @@ module LogStash
10
8
  def self.patch
11
9
  verify_version
12
10
  patch_json
13
- patch_connection_stream
14
- patch_request
15
11
  end
16
12
 
17
13
  private
18
14
 
19
15
  def self.verify_version
20
- raise("Incompatible Twitter gem version and the LogStash::Json.load") unless ::Twitter::Version.to_s == "5.15.0"
21
- end
22
-
23
- def self.patch_connection_stream
24
- ::Twitter::Streaming::Connection.class_eval do
25
- def stream(request, response)
26
- socket = @tcp_socket_class.new(Resolv.getaddress(request.socket_host), request.socket_port)
27
- socket = ssl_stream(socket) if !request.using_proxy?
28
-
29
- request.stream(socket)
30
- while body = socket.readpartial(1024) # rubocop:disable AssignmentInCondition
31
- response << body
32
- end
33
- end
34
-
35
- def ssl_stream(client)
36
- client_context = OpenSSL::SSL::SSLContext.new
37
- ssl_client = @ssl_socket_class.new(client, client_context)
38
- ssl_client.connect
39
- end
40
-
41
- def normalized_port(scheme)
42
- HTTP::URI.port_mapping[scheme]
43
- end
44
- end
45
- end
46
-
47
- def self.patch_request
48
- ::Twitter::Streaming::Client.class_eval do
49
- def request(method, uri, params)
50
- before_request.call
51
- headers = ::Twitter::Headers.new(self, method, uri, params).request_headers
52
- request = ::HTTP::Request.new(method, uri + '?' + to_url_params(params), headers, proxy)
53
- response = ::Twitter::Streaming::Response.new do |data|
54
- if item = ::Twitter::Streaming::MessageParser.parse(data) # rubocop:disable AssignmentInCondition
55
- yield(item)
56
- end
57
- end
58
- @connection.stream(request, response)
59
- end
60
- end
16
+ raise("Incompatible Twitter gem version and the LogStash::Json.load") unless ::Twitter::Version.to_s == "6.2.0"
61
17
  end
62
18
 
63
19
  def self.patch_json
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-twitter'
4
- s.version = '4.0.0'
4
+ s.version = '4.0.1'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Reads events from the Twitter Streaming API"
7
7
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -19,9 +19,13 @@ Gem::Specification.new do |s|
19
19
  # Special flag to let us know this is actually a logstash plugin
20
20
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
21
21
 
22
+ # public_suffix 3.x+ includes ruby syntax from 2.1
23
+ # This effectively requires Logstash >= 6.x
24
+ s.required_ruby_version = '>= 2.1.0'
25
+
22
26
  # Gem dependencies
23
27
  s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
24
- s.add_runtime_dependency 'twitter', '5.15.0'
28
+ s.add_runtime_dependency 'twitter', '6.2.0'
25
29
  s.add_runtime_dependency 'http-form_data', '~> 2'
26
30
  s.add_runtime_dependency 'public_suffix', '~> 3'
27
31
  s.add_runtime_dependency 'stud', '>= 0.0.22', '< 0.1'
@@ -45,7 +45,7 @@ describe LogStash::Inputs::Twitter do
45
45
  RSpec::Sequencing.run_after(1, "update tweet status") do
46
46
  twt = "logstash_ci_publish partial tweet test #{Time.now} #{SecureRandom.hex(6)} $AAPL #lscipub @logstash https://www.elastic.co/downloads/logstash"
47
47
  publisher.update_with_media(twt, File.open(LogstashTwitterInput.fixture("small_smile.png")))
48
- end.then_after(3, "stop plugin") do
48
+ end.then_after(10, "stop plugin") do
49
49
  plugin.stop
50
50
  true
51
51
  end.value
@@ -64,10 +64,10 @@ describe LogStash::Inputs::Twitter do
64
64
  let(:full_tweets) { true }
65
65
 
66
66
  it "receives an event from the twitter stream" do
67
- RSpec::Sequencing.run_after(0.1, "update tweet status") do
67
+ RSpec::Sequencing.run_after(1, "update tweet status") do
68
68
  twt = "logstash_ci_publish full tweet test #{Time.now} #{SecureRandom.hex(6)} $AAPL #lscipub @logstash https://www.elastic.co/downloads/logstash"
69
69
  publisher.update_with_media(twt, File.open(LogstashTwitterInput.fixture("small_smile.png")))
70
- end.then_after(3, "stop plugin") do
70
+ end.then_after(10, "stop plugin") do
71
71
  plugin.stop
72
72
  true
73
73
  end.value
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-twitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-12 00:00:00.000000000 Z
11
+ date: 2019-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -35,7 +35,7 @@ dependencies:
35
35
  requirements:
36
36
  - - '='
37
37
  - !ruby/object:Gem::Version
38
- version: 5.15.0
38
+ version: 6.2.0
39
39
  name: twitter
40
40
  prerelease: false
41
41
  type: :runtime
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
- version: 5.15.0
46
+ version: 6.2.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
172
  requirements:
173
173
  - - ">="
174
174
  - !ruby/object:Gem::Version
175
- version: '0'
175
+ version: 2.1.0
176
176
  required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - ">="