datasift 1.0.0 → 1.1.0
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/LICENSE +0 -0
- data/README.md +8 -1
- data/Rakefile +0 -0
- data/VERSION +1 -1
- data/config.yml +0 -0
- data/datasift.gemspec +13 -13
- data/examples/consume-stream.rb +1 -0
- data/examples/dpu.rb +1 -0
- data/examples/football-buffered.rb +1 -0
- data/examples/football.rb +1 -0
- data/examples/twitter-track.rb +1 -0
- data/lib/DataSift/apiclient.rb +3 -3
- data/lib/DataSift/definition.rb +1 -1
- data/lib/DataSift/exceptions.rb +0 -0
- data/lib/DataSift/mockapiclient.rb +0 -0
- data/lib/DataSift/stream_consumer.rb +0 -0
- data/lib/DataSift/stream_consumer_http.rb +2 -1
- data/lib/DataSift/user.rb +1 -4
- data/lib/datasift.rb +0 -0
- data/test/helper.rb +0 -0
- data/test/test_definition.rb +0 -0
- data/test/test_live_api.rb +0 -0
- data/test/test_user.rb +0 -0
- data/test/testdata.yml +0 -0
- metadata +107 -72
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -10,6 +10,13 @@ Install Instructions
|
|
10
10
|
|
11
11
|
sudo gem install datasift
|
12
12
|
|
13
|
+
Dependencies
|
14
|
+
------------
|
15
|
+
|
16
|
+
If you're using the source you'll need to install the dependencies.
|
17
|
+
|
18
|
+
sudo gem install yajl-ruby json rest-client
|
19
|
+
|
13
20
|
Simple example
|
14
21
|
--------------
|
15
22
|
|
@@ -33,6 +40,6 @@ See the DataSift documentation for full details of the data contained within eac
|
|
33
40
|
License
|
34
41
|
-------
|
35
42
|
|
36
|
-
All code contained in this repository is Copyright 2011 MediaSift Ltd.
|
43
|
+
All code contained in this repository is Copyright 2011-2012 MediaSift Ltd.
|
37
44
|
|
38
45
|
This code is released under the BSD license. Please see the LICENSE file for more details.
|
data/Rakefile
CHANGED
File without changes
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/config.yml
CHANGED
File without changes
|
data/datasift.gemspec
CHANGED
@@ -2,27 +2,27 @@
|
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
|
-
s.name
|
6
|
-
s.version
|
5
|
+
s.name = 'datasift'
|
6
|
+
s.version = File.open('VERSION').first
|
7
7
|
|
8
|
-
s.authors
|
9
|
-
s.email
|
10
|
-
s.description
|
11
|
-
s.summary
|
12
|
-
s.homepage = 'http://github.com/
|
8
|
+
s.authors = ['DataSift']
|
9
|
+
s.email = ['support@datasift.net']
|
10
|
+
s.description = %q{The official Ruby library for accessing the DataSift API. See http://datasift.com/ for full details and to sign up for an account.}
|
11
|
+
s.summary = %q{DataSift is a simple wrapper for the DataSift API.}
|
12
|
+
s.homepage = 'http://github.com/datasift/datasift-ruby'
|
13
13
|
|
14
|
-
s.platform
|
15
|
-
s.rubygems_version
|
16
|
-
s.required_rubygems_version
|
14
|
+
s.platform = Gem::Platform::RUBY
|
15
|
+
s.rubygems_version = %q{1.3.6}
|
16
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
|
17
17
|
|
18
18
|
s.add_runtime_dependency('rest-client', '~> 1.6.3')
|
19
|
-
s.add_runtime_dependency('
|
19
|
+
s.add_runtime_dependency('json', '~> 1')
|
20
20
|
s.add_runtime_dependency('yajl-ruby', '~> 0.8.2')
|
21
21
|
s.add_development_dependency('rdoc', '~> 0')
|
22
22
|
s.add_development_dependency('shoulda', '~> 2.11.3')
|
23
23
|
s.add_development_dependency('rspec', '~> 2.6.0')
|
24
24
|
|
25
|
-
s.files
|
26
|
-
s.test_files
|
25
|
+
s.files = `git ls-files`.split("\n")
|
26
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
27
27
|
s.require_paths = ["lib"]
|
28
28
|
end
|
data/examples/consume-stream.rb
CHANGED
@@ -19,6 +19,7 @@ end
|
|
19
19
|
require File.dirname(__FILE__) + '/../lib/datasift'
|
20
20
|
|
21
21
|
# Include the configuration - put your username and API key in this file
|
22
|
+
require 'yaml'
|
22
23
|
config = YAML::load(File.open(File.join(File.dirname(__FILE__), '..', 'config.yml')))
|
23
24
|
|
24
25
|
# Authenticate
|
data/examples/dpu.rb
CHANGED
@@ -21,6 +21,7 @@ def number_with_delimiter(number, delimiter=',')
|
|
21
21
|
end
|
22
22
|
|
23
23
|
# Include the configuration - put your username and API key in this file
|
24
|
+
require 'yaml'
|
24
25
|
config = YAML::load(File.open(File.join(File.dirname(__FILE__), '..', 'config.yml')))
|
25
26
|
|
26
27
|
# Get the CSDL from the command line or STDIN
|
data/examples/football.rb
CHANGED
data/examples/twitter-track.rb
CHANGED
@@ -21,6 +21,7 @@ end
|
|
21
21
|
require File.dirname(__FILE__) + '/../lib/datasift'
|
22
22
|
|
23
23
|
# Include the configuration - put your username and API key in this file
|
24
|
+
require 'yaml'
|
24
25
|
config = YAML::load(File.open(File.join(File.dirname(__FILE__), '..', 'config.yml')))
|
25
26
|
|
26
27
|
# Authenticate
|
data/lib/DataSift/apiclient.rb
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
# DataSift API.
|
10
10
|
|
11
11
|
require 'rest_client'
|
12
|
-
require '
|
12
|
+
require 'json'
|
13
13
|
|
14
14
|
module DataSift
|
15
15
|
# ApiCLient class.
|
@@ -46,7 +46,7 @@ module DataSift
|
|
46
46
|
retval['response_code'] = 200
|
47
47
|
|
48
48
|
# Parse the JSON response
|
49
|
-
retval['data'] =
|
49
|
+
retval['data'] = JSON.parse(res)
|
50
50
|
|
51
51
|
# Rate limit headers
|
52
52
|
if (res.headers[:x_ratelimit_limit])
|
@@ -61,7 +61,7 @@ module DataSift
|
|
61
61
|
retval['response_code'] = err.http_code
|
62
62
|
|
63
63
|
# And set the data
|
64
|
-
retval['data'] =
|
64
|
+
retval['data'] = JSON.parse(err.response)
|
65
65
|
end
|
66
66
|
|
67
67
|
retval
|
data/lib/DataSift/definition.rb
CHANGED
@@ -109,7 +109,7 @@ module DataSift
|
|
109
109
|
when 400
|
110
110
|
raise CompileFailedError, err
|
111
111
|
else
|
112
|
-
raise CompileFailedError, 'Unexpected APIError code: ' + err.http_code.to_s + ' [' + err + ']'
|
112
|
+
raise CompileFailedError, 'Unexpected APIError code: ' + err.http_code.to_s + ' [' + err.inspect + ']'
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
data/lib/DataSift/exceptions.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -12,6 +12,7 @@ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../')
|
|
12
12
|
require 'uri'
|
13
13
|
require 'socket'
|
14
14
|
require 'yajl'
|
15
|
+
require 'cgi'
|
15
16
|
|
16
17
|
module DataSift
|
17
18
|
|
@@ -31,7 +32,7 @@ module DataSift
|
|
31
32
|
if @response_head[:headers]["Transfer-Encoding"] == 'chunked'
|
32
33
|
if block_given?
|
33
34
|
chunkLeft = 0
|
34
|
-
while !@socket.eof? && (line = @socket.gets)
|
35
|
+
while !@socket.eof? && (line = @socket.gets) && @state == StreamConsumer::STATE_RUNNING
|
35
36
|
break if line.match /^0.*?\r\n/
|
36
37
|
next if line == "\r\n"
|
37
38
|
size = line.hex
|
data/lib/DataSift/user.rb
CHANGED
@@ -9,9 +9,6 @@
|
|
9
9
|
# API interactions by creating an instance of this class. Once initialised it
|
10
10
|
# provides factory methods for all of the functionality in the API.
|
11
11
|
|
12
|
-
require 'rest_client'
|
13
|
-
require 'crack'
|
14
|
-
|
15
12
|
module DataSift
|
16
13
|
# User class.
|
17
14
|
#
|
@@ -22,7 +19,7 @@ module DataSift
|
|
22
19
|
# provides factory methods for all of the functionality in the API.
|
23
20
|
#
|
24
21
|
class User
|
25
|
-
USER_AGENT = 'DataSiftRuby/
|
22
|
+
USER_AGENT = 'DataSiftRuby/1.1.0';
|
26
23
|
API_BASE_URL = 'api.datasift.com/';
|
27
24
|
STREAM_BASE_URL = 'stream.datasift.com/';
|
28
25
|
|
data/lib/datasift.rb
CHANGED
File without changes
|
data/test/helper.rb
CHANGED
File without changes
|
data/test/test_definition.rb
CHANGED
File without changes
|
data/test/test_live_api.rb
CHANGED
File without changes
|
data/test/test_user.rb
CHANGED
File without changes
|
data/test/testdata.yml
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,90 +1,112 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: datasift
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 1.1.0
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
-
|
11
|
+
authors:
|
12
|
+
- DataSift
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
date: 2012-02-24 00:00:00 +00:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: rest-client
|
16
|
-
|
17
|
-
|
18
|
-
requirements:
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
19
25
|
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 6
|
30
|
+
- 3
|
21
31
|
version: 1.6.3
|
22
32
|
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: json
|
23
36
|
prerelease: false
|
24
|
-
|
25
|
-
|
26
|
-
name: crack
|
27
|
-
requirement: &8778640 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
|
-
requirements:
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
30
39
|
- - ~>
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 1
|
43
|
+
version: "1"
|
33
44
|
type: :runtime
|
34
|
-
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
45
|
+
version_requirements: *id002
|
46
|
+
- !ruby/object:Gem::Dependency
|
37
47
|
name: yajl-ruby
|
38
|
-
|
39
|
-
|
40
|
-
requirements:
|
48
|
+
prerelease: false
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
41
51
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
- 8
|
56
|
+
- 2
|
43
57
|
version: 0.8.2
|
44
58
|
type: :runtime
|
45
|
-
|
46
|
-
|
47
|
-
- !ruby/object:Gem::Dependency
|
59
|
+
version_requirements: *id003
|
60
|
+
- !ruby/object:Gem::Dependency
|
48
61
|
name: rdoc
|
49
|
-
|
50
|
-
|
51
|
-
requirements:
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
52
65
|
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
version: "0"
|
55
70
|
type: :development
|
56
|
-
|
57
|
-
|
58
|
-
- !ruby/object:Gem::Dependency
|
71
|
+
version_requirements: *id004
|
72
|
+
- !ruby/object:Gem::Dependency
|
59
73
|
name: shoulda
|
60
|
-
|
61
|
-
|
62
|
-
requirements:
|
74
|
+
prerelease: false
|
75
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
63
77
|
- - ~>
|
64
|
-
- !ruby/object:Gem::Version
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
segments:
|
80
|
+
- 2
|
81
|
+
- 11
|
82
|
+
- 3
|
65
83
|
version: 2.11.3
|
66
84
|
type: :development
|
67
|
-
|
68
|
-
|
69
|
-
- !ruby/object:Gem::Dependency
|
85
|
+
version_requirements: *id005
|
86
|
+
- !ruby/object:Gem::Dependency
|
70
87
|
name: rspec
|
71
|
-
|
72
|
-
|
73
|
-
requirements:
|
88
|
+
prerelease: false
|
89
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
74
91
|
- - ~>
|
75
|
-
- !ruby/object:Gem::Version
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
segments:
|
94
|
+
- 2
|
95
|
+
- 6
|
96
|
+
- 0
|
76
97
|
version: 2.6.0
|
77
98
|
type: :development
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
for full details and to sign up for an account.
|
82
|
-
email:
|
99
|
+
version_requirements: *id006
|
100
|
+
description: The official Ruby library for accessing the DataSift API. See http://datasift.com/ for full details and to sign up for an account.
|
101
|
+
email:
|
83
102
|
- support@datasift.net
|
84
103
|
executables: []
|
104
|
+
|
85
105
|
extensions: []
|
106
|
+
|
86
107
|
extra_rdoc_files: []
|
87
|
-
|
108
|
+
|
109
|
+
files:
|
88
110
|
- LICENSE
|
89
111
|
- README.md
|
90
112
|
- Rakefile
|
@@ -109,28 +131,41 @@ files:
|
|
109
131
|
- test/test_live_api.rb
|
110
132
|
- test/test_user.rb
|
111
133
|
- test/testdata.yml
|
112
|
-
|
134
|
+
has_rdoc: true
|
135
|
+
homepage: http://github.com/datasift/datasift-ruby
|
113
136
|
licenses: []
|
137
|
+
|
114
138
|
post_install_message:
|
115
139
|
rdoc_options: []
|
116
|
-
|
140
|
+
|
141
|
+
require_paths:
|
117
142
|
- lib
|
118
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
requirements:
|
127
|
-
- -
|
128
|
-
- !ruby/object:Gem::Version
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
segments:
|
148
|
+
- 0
|
149
|
+
version: "0"
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
segments:
|
155
|
+
- 1
|
156
|
+
- 3
|
157
|
+
- 6
|
129
158
|
version: 1.3.6
|
130
159
|
requirements: []
|
160
|
+
|
131
161
|
rubyforge_project:
|
132
|
-
rubygems_version: 1.
|
162
|
+
rubygems_version: 1.3.6
|
133
163
|
signing_key:
|
134
164
|
specification_version: 3
|
135
|
-
summary:
|
136
|
-
test_files:
|
165
|
+
summary: DataSift is a simple wrapper for the DataSift API.
|
166
|
+
test_files:
|
167
|
+
- test/helper.rb
|
168
|
+
- test/test_definition.rb
|
169
|
+
- test/test_live_api.rb
|
170
|
+
- test/test_user.rb
|
171
|
+
- test/testdata.yml
|