rsift 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsift (0.3.1)
4
+ rsift (0.3.2)
5
+ em-http-request (= 0.2.15)
5
6
  jakal (= 0.1.95)
6
7
  json (= 1.4.6)
7
8
  rake (= 0.8.7)
@@ -20,6 +21,10 @@ GEM
20
21
  nokogiri (>= 1.3.3)
21
22
  crack (0.1.8)
22
23
  curb (0.7.9)
24
+ em-http-request (0.2.15)
25
+ addressable (>= 2.0.0)
26
+ eventmachine (>= 0.12.9)
27
+ eventmachine (0.12.10)
23
28
  hoe (2.8.0)
24
29
  rake (>= 0.8.7)
25
30
  hpricot (0.8.3)
@@ -45,6 +50,7 @@ PLATFORMS
45
50
  ruby
46
51
 
47
52
  DEPENDENCIES
53
+ em-http-request (= 0.2.15)
48
54
  jakal (= 0.1.95)
49
55
  json (= 1.4.6)
50
56
  rake (= 0.8.7)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # rsift
2
2
 
3
- This is a Ruby client wrapper for the Datasift API. Right now, it just handles data, streams and comments.
3
+ This is a Ruby client wrapper for the Datasift API. Right now, it just handles data, streams and comments. There's also a class to handle receiving data from Datasift using their websockets implementation.
4
4
 
5
5
  Current Limitations
6
6
 
@@ -19,4 +19,12 @@ Current Limitations
19
19
 
20
20
  json_response = comment.do("create", opts)
21
21
 
22
- Check the tests for more usage examples.
22
+
23
+ # The websockets API can be used like this:
24
+
25
+ Rsift::Socket.perform(stream_identifier) do |tweet|
26
+ puts tweet
27
+ end
28
+
29
+ Check the tests for more usage examples.
30
+
data/lib/rsift/socket.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'em-http'
2
+
1
3
  module Rsift
2
4
 
3
5
  class Socket
@@ -8,12 +10,12 @@ module Rsift
8
10
  http = EventMachine::HttpRequest.new(
9
11
  "#{endpoint}#{stream_identifier}").get(:timeout => 0)
10
12
 
11
- http.callback { puts "Connected to rsift" }
13
+ http.callback { puts "Connected to datasift" }
12
14
  http.errback { puts "something has failed" }
13
15
  http.disconnect { puts "oops, dropped connection?" }
14
16
 
15
17
  http.stream { |msg|
16
- yield
18
+ yield msg
17
19
  }
18
20
  }
19
21
  end
data/lib/rsift/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rsift
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
data/rsift.gemspec CHANGED
@@ -11,8 +11,10 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "http://github.com/sshingler/rsift"
12
12
  s.summary = %q{Ruby wrapper for the Datasift API}
13
13
  s.description = <<-EOF
14
- A Ruby client/wrapper gem for the Datasift API.
15
- Right now, it just handles data, streams and comments.
14
+ This is a Ruby client wrapper for the Datasift API.
15
+ Right now, it just handles data, streams and comments.
16
+ There's also a class to handle receiving data from Datasift
17
+ using their websockets implementation.
16
18
  EOF
17
19
 
18
20
  s.files = `git ls-files`.split("\n")
@@ -23,6 +25,7 @@ EOF
23
25
  s.add_dependency("json", "1.4.6")
24
26
  s.add_dependency("rest-client", "1.4.2")
25
27
  s.add_dependency("jakal", "0.1.95")
28
+ s.add_dependency("em-http-request", "0.2.15")
26
29
 
27
30
  # Test libraries
28
31
  s.add_dependency("test-unit", "1.2.3")
@@ -0,0 +1,17 @@
1
+ require "test/unit"
2
+ require "shoulda"
3
+ require "./lib/rsift"
4
+
5
+ class SocketTest < Test::Unit::TestCase
6
+
7
+ #This is a pretty lame test. Not sure how to improve.
8
+ context "with a socket" do
9
+ should "get data" do
10
+ stream_identifier = "b6acf9e14021a8b6c3e18f17e8a1de19"
11
+ Rsift::Socket.perform(stream_identifier) do |tweet|
12
+ assert_not_nil tweet
13
+ break
14
+ end
15
+ end
16
+ end
17
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 2
9
- version: 0.3.2
8
+ - 3
9
+ version: 0.3.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Steven Shingler
@@ -78,9 +78,24 @@ dependencies:
78
78
  type: :runtime
79
79
  version_requirements: *id004
80
80
  - !ruby/object:Gem::Dependency
81
- name: test-unit
81
+ name: em-http-request
82
82
  prerelease: false
83
83
  requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - "="
87
+ - !ruby/object:Gem::Version
88
+ segments:
89
+ - 0
90
+ - 2
91
+ - 15
92
+ version: 0.2.15
93
+ type: :runtime
94
+ version_requirements: *id005
95
+ - !ruby/object:Gem::Dependency
96
+ name: test-unit
97
+ prerelease: false
98
+ requirement: &id006 !ruby/object:Gem::Requirement
84
99
  none: false
85
100
  requirements:
86
101
  - - "="
@@ -91,11 +106,11 @@ dependencies:
91
106
  - 3
92
107
  version: 1.2.3
93
108
  type: :runtime
94
- version_requirements: *id005
109
+ version_requirements: *id006
95
110
  - !ruby/object:Gem::Dependency
96
111
  name: shoulda
97
112
  prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
113
+ requirement: &id007 !ruby/object:Gem::Requirement
99
114
  none: false
100
115
  requirements:
101
116
  - - "="
@@ -106,11 +121,11 @@ dependencies:
106
121
  - 3
107
122
  version: 2.11.3
108
123
  type: :runtime
109
- version_requirements: *id006
124
+ version_requirements: *id007
110
125
  - !ruby/object:Gem::Dependency
111
126
  name: webmock
112
127
  prerelease: false
113
- requirement: &id007 !ruby/object:Gem::Requirement
128
+ requirement: &id008 !ruby/object:Gem::Requirement
114
129
  none: false
115
130
  requirements:
116
131
  - - "="
@@ -121,10 +136,12 @@ dependencies:
121
136
  - 1
122
137
  version: 1.6.1
123
138
  type: :runtime
124
- version_requirements: *id007
139
+ version_requirements: *id008
125
140
  description: |
126
- A Ruby client/wrapper gem for the Datasift API.
127
- Right now, it just handles data, streams and comments.
141
+ This is a Ruby client wrapper for the Datasift API.
142
+ Right now, it just handles data, streams and comments.
143
+ There's also a class to handle receiving data from Datasift
144
+ using their websockets implementation.
128
145
 
129
146
  email:
130
147
  - shingler@gmail.com
@@ -153,6 +170,7 @@ files:
153
170
  - rsift.gemspec
154
171
  - test/unit/comment_test.rb
155
172
  - test/unit/data_test.rb
173
+ - test/unit/socket_test.rb
156
174
  - test/unit/stream_test.rb
157
175
  has_rdoc: true
158
176
  homepage: http://github.com/sshingler/rsift