twitter-stream 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of twitter-stream might be problematic. Click here for more details.

data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.8
1
+ 0.1.9
@@ -33,7 +33,8 @@ module Twitter
33
33
  :proxy => ENV['HTTP_PROXY'],
34
34
  :auth => nil,
35
35
  :oauth => {},
36
- :filters => []
36
+ :filters => [],
37
+ :params => {},
37
38
  }
38
39
 
39
40
  attr_accessor :code
@@ -183,16 +184,16 @@ module Twitter
183
184
 
184
185
  if @proxy
185
186
  # proxies need the request to be for the full url
186
- request_uri = "http#{'s' if @options[:ssl]}://#{@options[:host]}:#{@options[:port]}#{request_uri}"
187
+ request_uri = "#{uri_base}:#{@options[:port]}#{request_uri}"
187
188
  end
188
189
 
189
190
  content = @options[:content]
190
191
 
191
- if !@options[:filters].empty?
192
+ unless q = query.empty?
192
193
  if @options[:method].to_s.upcase == 'GET'
193
- request_uri << "?#{query}"
194
+ request_uri << "?#{q}"
194
195
  else
195
- content = query
196
+ content = q
196
197
  end
197
198
  end
198
199
 
@@ -269,6 +270,10 @@ module Twitter
269
270
  @reconnect_retries = 0
270
271
  end
271
272
 
273
+ #
274
+ # URL and request components
275
+ #
276
+
272
277
  # :filters => %w(miama lebron jesus)
273
278
  # :oauth => {
274
279
  # :consumer_key => [key],
@@ -277,14 +282,25 @@ module Twitter
277
282
  # :access_secret => [access secret]
278
283
  # }
279
284
  def oauth_header
280
- uri = "http://#{@options[:host]}#{@options[:path]}"
285
+ uri = uri_base + @options[:path]
281
286
  ::ROAuth.header(@options[:oauth], uri, params, @options[:method])
282
287
  end
283
288
 
289
+ # Scheme (https if ssl, http otherwise) and host part of URL
290
+ def uri_base
291
+ "http#{'s' if @options[:ssl]}://#{@options[:host]}"
292
+ end
293
+
284
294
  # Normalized query hash of escaped string keys and escaped string values
285
295
  # nil values are skipped
286
296
  def params
287
- { 'track' => escape(@options[:filters].join(",")) }
297
+ flat = {}
298
+ @options[:params].merge( :track => @options[:filters] ).each do |param, val|
299
+ next if val.empty?
300
+ val = val.join(",") if val.respond_to?(:join)
301
+ flat[escape(param)] = escape(val)
302
+ end
303
+ flat
288
304
  end
289
305
 
290
306
  def query
@@ -4,6 +4,22 @@ require 'twitter/json_stream'
4
4
 
5
5
  include Twitter
6
6
 
7
+ Host = "127.0.0.1"
8
+ Port = 9550
9
+
10
+ class JSONServer < EM::Connection
11
+ attr_accessor :data
12
+ def receive_data data
13
+ $recieved_data = data
14
+ send_data $data_to_send
15
+ EventMachine.next_tick {
16
+ close_connection if $close_connection
17
+ }
18
+ end
19
+ end
20
+
21
+
22
+
7
23
  describe JSONStream do
8
24
 
9
25
  context "on create" do
@@ -36,20 +52,6 @@ describe JSONStream do
36
52
  end
37
53
  end
38
54
 
39
- Host = "127.0.0.1"
40
- Port = 9550
41
-
42
- class JSONServer < EM::Connection
43
- attr_accessor :data
44
- def receive_data data
45
- $recieved_data = data
46
- send_data $data_to_send
47
- EventMachine.next_tick {
48
- close_connection if $close_connection
49
- }
50
- end
51
- end
52
-
53
55
  context "on valid stream" do
54
56
  attr_reader :stream
55
57
  before :each do
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{twitter-stream}
8
- s.version = "0.1.8"
8
+ s.version = "0.1.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Vladimir Kolesnikov"]
12
- s.date = %q{2010-08-13}
12
+ s.date = %q{2010-09-30}
13
13
  s.description = %q{Simple Ruby client library for twitter streaming API. Uses EventMachine for connection handling. Adheres to twitter's reconnection guidline. JSON format only.}
14
14
  s.email = %q{voloko@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -27,10 +27,11 @@ Gem::Specification.new do |s|
27
27
  "spec/twitter/json_stream.rb",
28
28
  "twitter-stream.gemspec"
29
29
  ]
30
+ s.has_rdoc = true
30
31
  s.homepage = %q{http://github.com/voloko/twitter-stream}
31
32
  s.rdoc_options = ["--charset=UTF-8"]
32
33
  s.require_paths = ["lib"]
33
- s.rubygems_version = %q{1.3.7}
34
+ s.rubygems_version = %q{1.3.1}
34
35
  s.summary = %q{Twitter realtime API client}
35
36
  s.test_files = [
36
37
  "spec/spec_helper.rb",
@@ -40,9 +41,12 @@ Gem::Specification.new do |s|
40
41
 
41
42
  if s.respond_to? :specification_version then
42
43
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
- s.specification_version = 3
44
+ s.specification_version = 2
44
45
 
45
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
+ s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.8"])
48
+ s.add_runtime_dependency(%q<roauth>, [">= 0.0.2"])
49
+ s.add_development_dependency(%q<rspec>, [">= 1.2.8"])
46
50
  s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.8"])
47
51
  s.add_runtime_dependency(%q<roauth>, [">= 0.0.2"])
48
52
  s.add_development_dependency(%q<rspec>, [">= 1.2.8"])
@@ -50,11 +54,17 @@ Gem::Specification.new do |s|
50
54
  s.add_dependency(%q<eventmachine>, [">= 0.12.8"])
51
55
  s.add_dependency(%q<roauth>, [">= 0.0.2"])
52
56
  s.add_dependency(%q<rspec>, [">= 1.2.8"])
57
+ s.add_dependency(%q<eventmachine>, [">= 0.12.8"])
58
+ s.add_dependency(%q<roauth>, [">= 0.0.2"])
59
+ s.add_dependency(%q<rspec>, [">= 1.2.8"])
53
60
  end
54
61
  else
55
62
  s.add_dependency(%q<eventmachine>, [">= 0.12.8"])
56
63
  s.add_dependency(%q<roauth>, [">= 0.0.2"])
57
64
  s.add_dependency(%q<rspec>, [">= 1.2.8"])
65
+ s.add_dependency(%q<eventmachine>, [">= 0.12.8"])
66
+ s.add_dependency(%q<roauth>, [">= 0.0.2"])
67
+ s.add_dependency(%q<rspec>, [">= 1.2.8"])
58
68
  end
59
69
  end
60
70
 
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter-stream
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 8
10
- version: 0.1.8
4
+ version: 0.1.9
11
5
  platform: ruby
12
6
  authors:
13
7
  - Vladimir Kolesnikov
@@ -15,57 +9,69 @@ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
11
 
18
- date: 2010-08-13 00:00:00 +04:00
12
+ date: 2010-09-30 00:00:00 +04:00
19
13
  default_executable:
20
14
  dependencies:
21
15
  - !ruby/object:Gem::Dependency
22
16
  name: eventmachine
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
26
20
  requirements:
27
21
  - - ">="
28
22
  - !ruby/object:Gem::Version
29
- hash: 63
30
- segments:
31
- - 0
32
- - 12
33
- - 8
34
23
  version: 0.12.8
35
- type: :runtime
36
- version_requirements: *id001
24
+ version:
37
25
  - !ruby/object:Gem::Dependency
38
26
  name: roauth
39
- prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
42
30
  requirements:
43
31
  - - ">="
44
32
  - !ruby/object:Gem::Version
45
- hash: 27
46
- segments:
47
- - 0
48
- - 0
49
- - 2
50
33
  version: 0.0.2
51
- type: :runtime
52
- version_requirements: *id002
34
+ version:
53
35
  - !ruby/object:Gem::Dependency
54
36
  name: rspec
55
- prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
58
40
  requirements:
59
41
  - - ">="
60
42
  - !ruby/object:Gem::Version
61
- hash: 15
62
- segments:
63
- - 1
64
- - 2
65
- - 8
66
43
  version: 1.2.8
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: eventmachine
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.12.8
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: roauth
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 0.0.2
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: rspec
67
67
  type: :development
68
- version_requirements: *id003
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 1.2.8
74
+ version:
69
75
  description: Simple Ruby client library for twitter streaming API. Uses EventMachine for connection handling. Adheres to twitter's reconnection guidline. JSON format only.
70
76
  email: voloko@gmail.com
71
77
  executables: []
@@ -87,37 +93,29 @@ files:
87
93
  - twitter-stream.gemspec
88
94
  has_rdoc: true
89
95
  homepage: http://github.com/voloko/twitter-stream
90
- licenses: []
91
-
92
96
  post_install_message:
93
97
  rdoc_options:
94
98
  - --charset=UTF-8
95
99
  require_paths:
96
100
  - lib
97
101
  required_ruby_version: !ruby/object:Gem::Requirement
98
- none: false
99
102
  requirements:
100
103
  - - ">="
101
104
  - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
104
- - 0
105
105
  version: "0"
106
+ version:
106
107
  required_rubygems_version: !ruby/object:Gem::Requirement
107
- none: false
108
108
  requirements:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
- hash: 3
112
- segments:
113
- - 0
114
111
  version: "0"
112
+ version:
115
113
  requirements: []
116
114
 
117
115
  rubyforge_project:
118
- rubygems_version: 1.3.7
116
+ rubygems_version: 1.3.1
119
117
  signing_key:
120
- specification_version: 3
118
+ specification_version: 2
121
119
  summary: Twitter realtime API client
122
120
  test_files:
123
121
  - spec/spec_helper.rb