rsift 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1,5 +1,4 @@
1
1
  .bundle
2
- *.lock
3
2
  datasift.php
4
3
  config/keys.yml
5
4
  *._*
data/Gemfile.lock ADDED
@@ -0,0 +1,55 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rsift (0.3.1)
5
+ jakal (= 0.1.95)
6
+ json (= 1.4.6)
7
+ rake (= 0.8.7)
8
+ rest-client (= 1.4.2)
9
+ shoulda (= 2.11.3)
10
+ test-unit (= 1.2.3)
11
+ webmock (= 1.6.1)
12
+
13
+ GEM
14
+ remote: http://rubygems.org/
15
+ specs:
16
+ addressable (2.2.2)
17
+ calais (0.0.11)
18
+ curb (>= 0.1.4)
19
+ json (>= 1.1.3)
20
+ nokogiri (>= 1.3.3)
21
+ crack (0.1.8)
22
+ curb (0.7.9)
23
+ hoe (2.8.0)
24
+ rake (>= 0.8.7)
25
+ hpricot (0.8.3)
26
+ jakal (0.1.95)
27
+ calais (>= 0.0.9)
28
+ hpricot (>= 0.8.2)
29
+ json (>= 1.2.4)
30
+ rest-client (>= 1.4.2)
31
+ json (1.4.6)
32
+ mime-types (1.16)
33
+ nokogiri (1.4.4)
34
+ rake (0.8.7)
35
+ rest-client (1.4.2)
36
+ mime-types (>= 1.16)
37
+ shoulda (2.11.3)
38
+ test-unit (1.2.3)
39
+ hoe (>= 1.5.1)
40
+ webmock (1.6.1)
41
+ addressable (>= 2.2.2)
42
+ crack (>= 0.1.7)
43
+
44
+ PLATFORMS
45
+ ruby
46
+
47
+ DEPENDENCIES
48
+ jakal (= 0.1.95)
49
+ json (= 1.4.6)
50
+ rake (= 0.8.7)
51
+ rest-client (= 1.4.2)
52
+ rsift!
53
+ shoulda (= 2.11.3)
54
+ test-unit (= 1.2.3)
55
+ webmock (= 1.6.1)
data/README.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # rsift
2
2
 
3
- This is a Ruby 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.
4
4
 
5
- Check the tests for usage examples.
5
+ Current Limitations
6
+
7
+ * All calls require credentials to be passed in
8
+ * All responses are in JSON
9
+
10
+ # To get started:
11
+
12
+ stream = Rsift::Stream.new(api_url, api_key, username)
13
+
14
+ json_response = @stream.do("my")
15
+
16
+ comment = Rsift::Comment.new(api_url, api_key, username)
17
+
18
+ opts = {:stream_id => "1", :comment => "test comment"}
19
+
20
+ json_response = comment.do("create", opts)
21
+
22
+ Check the tests for more usage examples.
data/lib/rsift/comment.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative "model"
1
+ require File.dirname(__FILE__) + "/model.rb"
2
2
 
3
3
  module Rsift
4
4
  class Comment < Rsift::Model
data/lib/rsift/data.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative "model"
1
+ require File.dirname(__FILE__) + "/model.rb"
2
2
 
3
3
  module Rsift
4
4
  class Data < Rsift::Model
data/lib/rsift/model.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  module Rsift
2
-
3
2
  class Model
4
3
 
5
4
  def initialize(url, key, username)
@@ -0,0 +1,21 @@
1
+ module Rsift
2
+
3
+ class Socket
4
+
5
+ def self.perform(stream_identifier)
6
+ endpoint = "ws://stream.datasift.net:8080/"
7
+ EventMachine.run {
8
+ http = EventMachine::HttpRequest.new(
9
+ "#{endpoint}#{stream_identifier}").get(:timeout => 0)
10
+
11
+ http.callback { puts "Connected to rsift" }
12
+ http.errback { puts "something has failed" }
13
+ http.disconnect { puts "oops, dropped connection?" }
14
+
15
+ http.stream { |msg|
16
+ yield
17
+ }
18
+ }
19
+ end
20
+ end
21
+ end
data/lib/rsift/stream.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative "model"
1
+ require File.dirname(__FILE__) + "/model.rb"
2
2
 
3
3
  module Rsift
4
4
  class Stream < Rsift::Model
data/lib/rsift/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rsift
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
data/lib/rsift.rb CHANGED
@@ -6,6 +6,7 @@ require "rsift/connection"
6
6
  require "rsift/stream"
7
7
  require "rsift/comment"
8
8
  require "rsift/data"
9
+ require "rsift/socket"
9
10
 
10
11
  module Rsift
11
12
  class << self
data/rsift.gemspec CHANGED
@@ -23,8 +23,6 @@ EOF
23
23
  s.add_dependency("json", "1.4.6")
24
24
  s.add_dependency("rest-client", "1.4.2")
25
25
  s.add_dependency("jakal", "0.1.95")
26
- s.add_dependency("em-http-request", "0.2.15")
27
- s.add_dependency("yajl-ruby", "0.7.8")
28
26
 
29
27
  # Test libraries
30
28
  s.add_dependency("test-unit", "1.2.3")
@@ -1,7 +1,7 @@
1
1
  require "webmock/test_unit"
2
2
  require "test/unit"
3
3
  require "shoulda"
4
- require_relative "../../lib/rsift"
4
+ require "./lib/rsift"
5
5
 
6
6
  class CommentTest < Test::Unit::TestCase
7
7
  include WebMock::API
@@ -17,7 +17,7 @@ class CommentTest < Test::Unit::TestCase
17
17
  setup do
18
18
  body = '{"success":true}'
19
19
  stub_request(:get, /api.datasift.net\/comment/).
20
- with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
20
+ with(:headers => {'Accept'=>'*/*'}).
21
21
  to_return(:status => 200, :body => body, :headers => {})
22
22
 
23
23
  end
@@ -1,7 +1,7 @@
1
1
  require "webmock/test_unit"
2
2
  require "test/unit"
3
3
  require "shoulda"
4
- require_relative "../../lib/rsift"
4
+ require "./lib/rsift"
5
5
 
6
6
  class DataTest < Test::Unit::TestCase
7
7
  include WebMock::API
@@ -16,9 +16,14 @@ class DataTest < Test::Unit::TestCase
16
16
  context "with data" do
17
17
  setup do
18
18
  body = '{"success":true}'
19
+ # stub_request(:get, /api.datasift.net\/stream.json/).
20
+ # with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
21
+ # to_return(:status => 200, :body => body, :headers => {})
22
+ #
19
23
  stub_request(:get, /api.datasift.net\/stream.json/).
20
- with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
21
- to_return(:status => 200, :body => body, :headers => {})
24
+ with(:headers => {'Accept'=>'*/*'}).
25
+ to_return(:status => 200, :body => body, :headers => {})
26
+
22
27
 
23
28
  end
24
29
 
@@ -1,7 +1,7 @@
1
1
  require "webmock/test_unit"
2
2
  require "test/unit"
3
3
  require "shoulda"
4
- require_relative "../../lib/rsift"
4
+ require "./lib/rsift"
5
5
 
6
6
  class StreamTest < Test::Unit::TestCase
7
7
  include WebMock::API
@@ -17,7 +17,7 @@ class StreamTest < Test::Unit::TestCase
17
17
  setup do
18
18
  body = '{"success":true}'
19
19
  stub_request(:get, /api.datasift.net\/stream/).
20
- with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
20
+ with(:headers => {'Accept'=>'*/*'}).
21
21
  to_return(:status => 200, :body => body, :headers => {})
22
22
 
23
23
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 1
9
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Steven Shingler
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-23 00:00:00 +00:00
17
+ date: 2010-12-28 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -77,40 +77,10 @@ dependencies:
77
77
  version: 0.1.95
78
78
  type: :runtime
79
79
  version_requirements: *id004
80
- - !ruby/object:Gem::Dependency
81
- name: em-http-request
82
- prerelease: false
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: yajl-ruby
97
- prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
99
- none: false
100
- requirements:
101
- - - "="
102
- - !ruby/object:Gem::Version
103
- segments:
104
- - 0
105
- - 7
106
- - 8
107
- version: 0.7.8
108
- type: :runtime
109
- version_requirements: *id006
110
80
  - !ruby/object:Gem::Dependency
111
81
  name: test-unit
112
82
  prerelease: false
113
- requirement: &id007 !ruby/object:Gem::Requirement
83
+ requirement: &id005 !ruby/object:Gem::Requirement
114
84
  none: false
115
85
  requirements:
116
86
  - - "="
@@ -121,11 +91,11 @@ dependencies:
121
91
  - 3
122
92
  version: 1.2.3
123
93
  type: :runtime
124
- version_requirements: *id007
94
+ version_requirements: *id005
125
95
  - !ruby/object:Gem::Dependency
126
96
  name: shoulda
127
97
  prerelease: false
128
- requirement: &id008 !ruby/object:Gem::Requirement
98
+ requirement: &id006 !ruby/object:Gem::Requirement
129
99
  none: false
130
100
  requirements:
131
101
  - - "="
@@ -136,11 +106,11 @@ dependencies:
136
106
  - 3
137
107
  version: 2.11.3
138
108
  type: :runtime
139
- version_requirements: *id008
109
+ version_requirements: *id006
140
110
  - !ruby/object:Gem::Dependency
141
111
  name: webmock
142
112
  prerelease: false
143
- requirement: &id009 !ruby/object:Gem::Requirement
113
+ requirement: &id007 !ruby/object:Gem::Requirement
144
114
  none: false
145
115
  requirements:
146
116
  - - "="
@@ -151,7 +121,7 @@ dependencies:
151
121
  - 1
152
122
  version: 1.6.1
153
123
  type: :runtime
154
- version_requirements: *id009
124
+ version_requirements: *id007
155
125
  description: |
156
126
  A Ruby client/wrapper gem for the Datasift API.
157
127
  Right now, it just handles data, streams and comments.
@@ -168,6 +138,7 @@ files:
168
138
  - .gitignore
169
139
  - .rvmrc
170
140
  - Gemfile
141
+ - Gemfile.lock
171
142
  - README.md
172
143
  - Rakefile
173
144
  - config/keys_example.yml
@@ -176,6 +147,7 @@ files:
176
147
  - lib/rsift/connection.rb
177
148
  - lib/rsift/data.rb
178
149
  - lib/rsift/model.rb
150
+ - lib/rsift/socket.rb
179
151
  - lib/rsift/stream.rb
180
152
  - lib/rsift/version.rb
181
153
  - rsift.gemspec