predictionio 0.8.2 → 0.8.3
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.
- checksums.yaml +4 -4
- data/lib/predictionio/connection.rb +3 -6
- data/lib/predictionio/engine_client.rb +2 -4
- data/lib/predictionio/event_client.rb +10 -11
- data/lib/predictionio/version.rb +3 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc76e93ff1fab8a8b64c20b829a9e69cfd7012ce
|
4
|
+
data.tar.gz: 5beeca9b2a0c237bacaa31459cae35c91984dcdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8658f74d556d39a6784c5d8b5e17adec7bcf572122929ec042a92f8a7311cb0498cd020a3db19f3a753321eead44e72aed5b78ac30f82e0476e9d3e8a14f438
|
7
|
+
data.tar.gz: c3ece6c9ce8303abf3247a7e879792ebb68720409630b045af82bddb0cc6afba3d56e48e3d950707b8949871237cbfc9b7631a19570c1a4a0ef635268f7820bf
|
@@ -22,8 +22,7 @@ module PredictionIO
|
|
22
22
|
threads.times do
|
23
23
|
Thread.new do
|
24
24
|
begin
|
25
|
-
Net::HTTP.start(uri.host, uri.port,
|
26
|
-
:use_ssl => uri.scheme == 'https') do |http|
|
25
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
27
26
|
@counter_lock.synchronize do
|
28
27
|
@connections += 1
|
29
28
|
end
|
@@ -46,7 +45,7 @@ module PredictionIO
|
|
46
45
|
http_req = Net::HTTP::Post.new("#{uri.path}#{request.path}")
|
47
46
|
http_req.set_form_data(request.params)
|
48
47
|
else
|
49
|
-
http_req = Net::HTTP::Post.new("#{uri.path}#{request.path}", initheader = {'Content-Type' => 'application/json'})
|
48
|
+
http_req = Net::HTTP::Post.new("#{uri.path}#{request.path}", initheader = { 'Content-Type' => 'application/json' })
|
50
49
|
http_req.body = request.params
|
51
50
|
end
|
52
51
|
begin
|
@@ -93,9 +92,7 @@ module PredictionIO
|
|
93
92
|
# Create an asynchronous request and response package, put it in the pending queue, and return the response object.
|
94
93
|
def request(method, request)
|
95
94
|
response = AsyncResponse.new(request)
|
96
|
-
@packages.push(:method
|
97
|
-
:request => request,
|
98
|
-
:response => response)
|
95
|
+
@packages.push(method: method, request: request, response: response)
|
99
96
|
response
|
100
97
|
end
|
101
98
|
|
@@ -51,8 +51,7 @@ module PredictionIO
|
|
51
51
|
# - 1 concurrent HTTP(S) connections (threads)
|
52
52
|
# - API entry point at http://localhost:8000 (apiurl)
|
53
53
|
# - a 60-second timeout for each HTTP(S) connection (thread_timeout)
|
54
|
-
def initialize(apiurl = 'http://localhost:8000', threads = 1,
|
55
|
-
thread_timeout = 60)
|
54
|
+
def initialize(apiurl = 'http://localhost:8000', threads = 1, thread_timeout = 60)
|
56
55
|
@http = PredictionIO::Connection.new(URI(apiurl), threads, thread_timeout)
|
57
56
|
end
|
58
57
|
|
@@ -108,8 +107,7 @@ module PredictionIO
|
|
108
107
|
#
|
109
108
|
# See also #send_query.
|
110
109
|
def asend_query(query)
|
111
|
-
@http.apost(PredictionIO::AsyncRequest.new('/queries.json',
|
112
|
-
query.to_json))
|
110
|
+
@http.apost(PredictionIO::AsyncRequest.new('/queries.json', query.to_json))
|
113
111
|
end
|
114
112
|
|
115
113
|
# :category: Synchronous Methods
|
@@ -72,7 +72,7 @@ module PredictionIO
|
|
72
72
|
# begin
|
73
73
|
# result = client.record_user_action_on_item('rate', 'foouser',
|
74
74
|
# 'baritem',
|
75
|
-
# '
|
75
|
+
# 'rating' => 4)
|
76
76
|
# rescue PredictionIO::EventClient::NotCreatedError => e
|
77
77
|
# ...
|
78
78
|
# end
|
@@ -84,8 +84,7 @@ module PredictionIO
|
|
84
84
|
# - 1 concurrent HTTP(S) connections (threads)
|
85
85
|
# - API entry point at http://localhost:7070 (apiurl)
|
86
86
|
# - a 60-second timeout for each HTTP(S) connection (thread_timeout)
|
87
|
-
def initialize(access_key, apiurl = 'http://localhost:7070', threads = 1,
|
88
|
-
thread_timeout = 60)
|
87
|
+
def initialize(access_key, apiurl = 'http://localhost:7070', threads = 1, thread_timeout = 60)
|
89
88
|
@access_key = access_key
|
90
89
|
@http = PredictionIO::Connection.new(URI(apiurl), threads, thread_timeout)
|
91
90
|
end
|
@@ -164,7 +163,7 @@ module PredictionIO
|
|
164
163
|
#
|
165
164
|
# See also #set_user.
|
166
165
|
def aset_user(uid, optional = {})
|
167
|
-
acreate_event('$set', '
|
166
|
+
acreate_event('$set', 'user', uid, optional)
|
168
167
|
end
|
169
168
|
|
170
169
|
# :category: Synchronous Methods
|
@@ -194,7 +193,7 @@ module PredictionIO
|
|
194
193
|
fail(ArgumentError, 'properties must be present when event is $unset')
|
195
194
|
optional['properties'].empty? &&
|
196
195
|
fail(ArgumentError, 'properties cannot be empty when event is $unset')
|
197
|
-
acreate_event('$unset', '
|
196
|
+
acreate_event('$unset', 'user', uid, optional)
|
198
197
|
end
|
199
198
|
|
200
199
|
# :category: Synchronous Methods
|
@@ -218,7 +217,7 @@ module PredictionIO
|
|
218
217
|
#
|
219
218
|
# See also #delete_user.
|
220
219
|
def adelete_user(uid)
|
221
|
-
acreate_event('$delete', '
|
220
|
+
acreate_event('$delete', 'user', uid)
|
222
221
|
end
|
223
222
|
|
224
223
|
# :category: Synchronous Methods
|
@@ -242,7 +241,7 @@ module PredictionIO
|
|
242
241
|
#
|
243
242
|
# See also #set_item.
|
244
243
|
def aset_item(iid, optional = {})
|
245
|
-
acreate_event('$set', '
|
244
|
+
acreate_event('$set', 'item', iid, optional)
|
246
245
|
end
|
247
246
|
|
248
247
|
# :category: Synchronous Methods
|
@@ -272,7 +271,7 @@ module PredictionIO
|
|
272
271
|
fail(ArgumentError, 'properties must be present when event is $unset')
|
273
272
|
optional['properties'].empty? &&
|
274
273
|
fail(ArgumentError, 'properties cannot be empty when event is $unset')
|
275
|
-
acreate_event('$unset', '
|
274
|
+
acreate_event('$unset', 'item', iid, optional)
|
276
275
|
end
|
277
276
|
|
278
277
|
# :category: Synchronous Methods
|
@@ -296,7 +295,7 @@ module PredictionIO
|
|
296
295
|
#
|
297
296
|
# See also #delete_item.
|
298
297
|
def adelete_item(uid)
|
299
|
-
acreate_event('$delete', '
|
298
|
+
acreate_event('$delete', 'item', uid)
|
300
299
|
end
|
301
300
|
|
302
301
|
# :category: Synchronous Methods
|
@@ -320,9 +319,9 @@ module PredictionIO
|
|
320
319
|
#
|
321
320
|
# See also #record_user_action_on_item.
|
322
321
|
def arecord_user_action_on_item(action, uid, iid, optional = {})
|
323
|
-
optional['targetEntityType'] = '
|
322
|
+
optional['targetEntityType'] = 'item'
|
324
323
|
optional['targetEntityId'] = iid
|
325
|
-
acreate_event(action, '
|
324
|
+
acreate_event(action, 'user', uid, optional)
|
326
325
|
end
|
327
326
|
|
328
327
|
# :category: Synchronous Methods
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: predictionio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The PredictionIO Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
PredictionIO is a prediction server for building smart applications. This gem
|
15
15
|
provides convenient access of the PredictionIO API to Ruby programmers so that
|
16
|
-
they can focus on
|
16
|
+
they can focus on application logic.
|
17
17
|
email: support@prediction.io
|
18
18
|
executables: []
|
19
19
|
extensions: []
|
@@ -25,6 +25,7 @@ files:
|
|
25
25
|
- lib/predictionio/connection.rb
|
26
26
|
- lib/predictionio/engine_client.rb
|
27
27
|
- lib/predictionio/event_client.rb
|
28
|
+
- lib/predictionio/version.rb
|
28
29
|
homepage: http://prediction.io
|
29
30
|
licenses:
|
30
31
|
- Apache-2.0
|
@@ -35,12 +36,12 @@ require_paths:
|
|
35
36
|
- lib
|
36
37
|
required_ruby_version: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
|
-
- -
|
39
|
+
- - '>='
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
version: '1.9'
|
41
42
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
43
|
requirements:
|
43
|
-
- -
|
44
|
+
- - '>='
|
44
45
|
- !ruby/object:Gem::Version
|
45
46
|
version: '0'
|
46
47
|
requirements: []
|