predictionio 0.7.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a0cd7b4e99c6db76f57ca47d07b96c3c53820e8
4
- data.tar.gz: d46e42deee2a425b7fdd9bc77f146ef6ed722a21
3
+ metadata.gz: dc02d867a2b406fd1b936187c0cc13a3ca3352cb
4
+ data.tar.gz: 4b29fa04ca835cfe1294080f3f40e3d5a83b6af4
5
5
  SHA512:
6
- metadata.gz: 39451eb1e6eb960b0213d88e3f3c46b6f6ba99117ad2be4c012e63451c6a993d53520535703c015db0c2043948bd1b23d5b9e80f7c54423723cd37bc8e416923
7
- data.tar.gz: 1c5e961a5933288e91af6616cd53376811dc5d4b62f27b469e6fa929f138cc5748a0fd9618ab117d29db228103f4d352d7055164bffdfd07b5f3c746a44fba7d
6
+ metadata.gz: fd0f40e0dcf0492fbb2c74af5c104ccd07d66832a416bb39fec3ed52525bddbf8636a0879f9034b7d489832747aa10fd3b6f6206e88d36c4f047c4e470caca83
7
+ data.tar.gz: 934022684046923e653e5f13ae6ce395c6e921f60242a36d221d69689f39e93e7958f416d6585d46fd9e482ddf1874781e935fe986e5e53941f0a271045b98bb
data/lib/predictionio.rb CHANGED
@@ -1 +1,38 @@
1
- require "predictionio/client"
1
+ require 'predictionio/client'
2
+ require 'predictionio/event_client'
3
+ require 'predictionio/engine_client'
4
+
5
+ # The PredictionIO module contains classes that provide convenient access of
6
+ # PredictionIO Event API and Engine Instance over HTTP/HTTPS.
7
+ #
8
+ # To create an app and perform predictions, please download the PredictionIO
9
+ # suite from http://prediction.io.
10
+ #
11
+ # Most functionality is provided by PredictionIO::EventClient and
12
+ # PredictionIO::EngineClient classes.
13
+ #
14
+ # == Deprecation Notice
15
+ #
16
+ # Pre-0.7.x series support is now deprecated. All existing users are strongly
17
+ # encouraged to migrate to 0.8.x.
18
+ #
19
+ # The old Client interface is retained in case of any accidental Gem upgrade.
20
+ # It will be removed in the next minor version.
21
+ #
22
+ # == High-performance Asynchronous Backend
23
+ #
24
+ # All REST request methods come in both synchronous and asynchronous flavors.
25
+ # Both flavors accept the same set of arguments. In addition, all synchronous
26
+ # request methods can instead accept a PredictionIO::AsyncResponse object
27
+ # generated from asynchronous request methods as its first argument. In this
28
+ # case, the method will block until a response is received from it.
29
+ #
30
+ # Any network reconnection and request retry is automatically handled in the
31
+ # background. Exceptions will be thrown after a request times out to avoid
32
+ # infinite blocking.
33
+ #
34
+ # == Installation
35
+ # The easiest way is to use RubyGems:
36
+ # gem install predictionio
37
+ module PredictionIO
38
+ end
@@ -1,5 +1,6 @@
1
1
  module PredictionIO
2
- # This class contains the URI path and query parameters that is consumed by PredictionIO::Connection for asynchronous HTTP requests.
2
+ # This class contains the URI path and query parameters that is consumed by
3
+ # PredictionIO::Connection for asynchronous HTTP requests.
3
4
  class AsyncRequest
4
5
 
5
6
  # The path portion of the request URI.
@@ -8,7 +9,8 @@ module PredictionIO
8
9
  # Query parameters, or form data.
9
10
  attr_reader :params
10
11
 
11
- # Populates the package with request URI path, and optionally query parameters or form data.
12
+ # Populates the package with request URI path, and optionally query
13
+ # parameters or form data.
12
14
  def initialize(path, params = {})
13
15
  @params = params
14
16
  @path = path
@@ -11,13 +11,7 @@ require 'predictionio/async_request'
11
11
  require 'predictionio/async_response'
12
12
  require 'predictionio/connection'
13
13
 
14
- # The PredictionIO module contains classes that provide convenient access of the PredictionIO output API over HTTP/HTTPS.
15
- #
16
- # To create an app and perform predictions, please download the PredictionIO suite from http://prediction.io.
17
- #
18
- # Most functionality is provided by the PredictionIO::Client class.
19
14
  module PredictionIO
20
-
21
15
  # This class contains methods that access PredictionIO via REST requests.
22
16
  #
23
17
  # Many REST request methods support optional arguments.
@@ -505,8 +499,8 @@ module PredictionIO
505
499
  # See #aget_itemrec_top_n for a description of special argument handling.
506
500
  #
507
501
  # call-seq:
508
- # aget_itemrec_top_n(engine, n, params = {})
509
- # aget_itemrec_top_n(async_response)
502
+ # get_itemrec_top_n(engine, n, params = {})
503
+ # get_itemrec_top_n(async_response)
510
504
  def get_itemrec_top_n(*args)
511
505
  uid_or_res = args[0]
512
506
  if uid_or_res.is_a?(PredictionIO::AsyncResponse)
@@ -565,8 +559,8 @@ module PredictionIO
565
559
  # See #aget_itemrank_ranked for a description of special argument handling.
566
560
  #
567
561
  # call-seq:
568
- # aget_itemrank_ranked(engine, n, params = {})
569
- # aget_itemrank_ranked(async_response)
562
+ # get_itemrank_ranked(engine, n, params = {})
563
+ # get_itemrank_ranked(async_response)
570
564
  def get_itemrank_ranked(*args)
571
565
  uid_or_res = args[0]
572
566
  if uid_or_res.is_a?(PredictionIO::AsyncResponse)
@@ -633,8 +627,8 @@ module PredictionIO
633
627
  # See #aget_itemsim_top_n for a description of special argument handling.
634
628
  #
635
629
  # call-seq:
636
- # aget_itemsim_top_n(engine, iid, n, params = {})
637
- # aget_itemsim_top_n(async_response)
630
+ # get_itemsim_top_n(engine, iid, n, params = {})
631
+ # get_itemsim_top_n(async_response)
638
632
  def get_itemsim_top_n(*args)
639
633
  uid_or_res = args[0]
640
634
  if uid_or_res.is_a?(PredictionIO::AsyncResponse)
@@ -34,29 +34,34 @@ module PredictionIO
34
34
  request = package[:request]
35
35
  response = package[:response]
36
36
  case package[:method]
37
- when "get"
37
+ when 'get'
38
38
  http_req = Net::HTTP::Get.new("#{uri.path}#{request.qpath}")
39
39
  begin
40
40
  response.set(http.request(http_req))
41
41
  rescue Exception => details
42
42
  response.set(details)
43
43
  end
44
- when "post"
45
- http_req = Net::HTTP::Post.new("#{uri.path}#{request.path}")
46
- http_req.set_form_data(request.params)
44
+ when 'post'
45
+ if request.params.is_a?(Hash)
46
+ http_req = Net::HTTP::Post.new("#{uri.path}#{request.path}")
47
+ http_req.set_form_data(request.params)
48
+ else
49
+ http_req = Net::HTTP::Post.new("#{uri.path}#{request.path}", initheader = {'Content-Type' => 'application/json'})
50
+ http_req.body = request.params
51
+ end
47
52
  begin
48
53
  response.set(http.request(http_req))
49
54
  rescue Exception => details
50
55
  response.set(details)
51
56
  end
52
- when "delete"
57
+ when 'delete'
53
58
  http_req = Net::HTTP::Delete.new("#{uri.path}#{request.qpath}")
54
59
  begin
55
60
  response.set(http.request(http_req))
56
61
  rescue Exception => details
57
62
  response.set(details)
58
63
  end
59
- when "exit"
64
+ when 'exit'
60
65
  @counter_lock.synchronize do
61
66
  @connections -= 1
62
67
  end
@@ -96,17 +101,17 @@ module PredictionIO
96
101
 
97
102
  # Shortcut to create an asynchronous GET request with the response object returned.
98
103
  def aget(areq)
99
- request("get", areq)
104
+ request('get', areq)
100
105
  end
101
106
 
102
107
  # Shortcut to create an asynchronous POST request with the response object returned.
103
108
  def apost(areq)
104
- request("post", areq)
109
+ request('post', areq)
105
110
  end
106
111
 
107
112
  # Shortcut to create an asynchronous DELETE request with the response object returned.
108
113
  def adelete(areq)
109
- request("delete", areq)
114
+ request('delete', areq)
110
115
  end
111
116
  end
112
117
  end
@@ -0,0 +1,127 @@
1
+ # Ruby SDK for convenient access of PredictionIO Output API.
2
+ #
3
+ # Author:: PredictionIO Team (support@prediction.io)
4
+ # Copyright:: Copyright (c) 2014 TappingStone, Inc.
5
+ # License:: Apache License, Version 2.0
6
+
7
+ require 'predictionio/async_request'
8
+ require 'predictionio/async_response'
9
+ require 'predictionio/connection'
10
+
11
+ module PredictionIO
12
+ # This class contains methods that interface with PredictionIO Engine
13
+ # Instances that are trained from PredictionIO built-in Engines.
14
+ #
15
+ # Many REST request methods support optional arguments. They can be supplied
16
+ # to these methods as Hash'es. For a complete reference, please visit
17
+ # http://prediction.io.
18
+ #
19
+ # == Synopsis
20
+ # In most cases, using synchronous methods. If you have a special performance
21
+ # requirement, you may want to take a look at asynchronous methods.
22
+ #
23
+ # === Instantiate an EngineClient
24
+ # # Include the PredictionIO SDK
25
+ # require 'predictionio'
26
+ #
27
+ # client = PredictionIO::EngineClient.new
28
+ #
29
+ # === Send a Query to Retrieve Predictions
30
+ # # PredictionIO call to record the view action
31
+ # begin
32
+ # result = client.query('uid' => 'foobar')
33
+ # rescue NotFoundError => e
34
+ # ...
35
+ # rescue BadRequestError => e
36
+ # ...
37
+ # rescue ServerError => e
38
+ # ...
39
+ # end
40
+ class EngineClient
41
+ # Raised when an event is not created after a synchronous API call.
42
+ class NotFoundError < StandardError; end
43
+
44
+ # Raised when the query is malformed.
45
+ class BadRequestError < StandardError; end
46
+
47
+ # Raised when the Engine Instance returns a server error.
48
+ class ServerError < StandardError; end
49
+
50
+ # Create a new PredictionIO Event Client with defaults:
51
+ # - 1 concurrent HTTP(S) connections (threads)
52
+ # - API entry point at http://localhost:7070 (apiurl)
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)
56
+ @http = PredictionIO::Connection.new(URI(apiurl), threads, thread_timeout)
57
+ end
58
+
59
+ # Returns the number of pending requests within the current client.
60
+ def pending_requests
61
+ @http.packages.size
62
+ end
63
+
64
+ # Returns PredictionIO's status in string.
65
+ def get_status
66
+ status = @http.aget(PredictionIO::AsyncRequest.new('/')).get
67
+ begin
68
+ status.body
69
+ rescue
70
+ status
71
+ end
72
+ end
73
+
74
+ protected
75
+
76
+ # Internal helper method. Do not call directly.
77
+ def sync_events(sync_m, *args)
78
+ if args[0].is_a?(PredictionIO::AsyncResponse)
79
+ response = args[0].get
80
+ else
81
+ response = send(sync_m, *args).get
82
+ end
83
+ return JSON.parse(response.body) if response.is_a?(Net::HTTPOK)
84
+ begin
85
+ msg = response.body
86
+ rescue
87
+ raise response
88
+ end
89
+ if response.is_a?(Net::HTTPBadRequest)
90
+ fail BadRequestError, msg
91
+ elsif response.is_a?(Net::HTTPNotFound)
92
+ fail NotFoundError, msg
93
+ elsif response.is_a?(Net::HTTPServerError)
94
+ fail ServerError, msg
95
+ else
96
+ fail msg
97
+ end
98
+ end
99
+
100
+ public
101
+
102
+ # :category: Asynchronous Methods
103
+ # Asynchronously sends a query and returns PredictionIO::AsyncResponse
104
+ # object immediately. The query should be a Ruby data structure that can be
105
+ # converted to a JSON object.
106
+ #
107
+ # Corresponding REST API method: POST /
108
+ #
109
+ # See also #send_query.
110
+ def asend_query(query)
111
+ @http.apost(PredictionIO::AsyncRequest.new('/queries.json',
112
+ query.to_json))
113
+ end
114
+
115
+ # :category: Synchronous Methods
116
+ # Synchronously sends a query and block until predictions are received.
117
+ #
118
+ # See also #asend_query.
119
+ #
120
+ # call-seq:
121
+ # send_query(data)
122
+ # send_query(async_response)
123
+ def send_query(*args)
124
+ sync_events(:asend_query, *args)
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,340 @@
1
+ # Ruby SDK for convenient access of PredictionIO Output API.
2
+ #
3
+ # Author:: PredictionIO Team (support@prediction.io)
4
+ # Copyright:: Copyright (c) 2014 TappingStone, Inc.
5
+ # License:: Apache License, Version 2.0
6
+
7
+ require 'predictionio/async_request'
8
+ require 'predictionio/async_response'
9
+ require 'predictionio/connection'
10
+ require 'date'
11
+
12
+ module PredictionIO
13
+ # This class contains methods that interface with the PredictionIO Event
14
+ # Server via the PredictionIO Event API using REST requests.
15
+ #
16
+ # Many REST request methods support optional arguments. They can be supplied
17
+ # to these methods as Hash'es. For a complete reference, please visit
18
+ # http://prediction.io.
19
+ #
20
+ # == High-performance Asynchronous Backend
21
+ #
22
+ # All REST request methods come in both synchronous and asynchronous flavors.
23
+ # Both flavors accept the same set of arguments. In addition, all synchronous
24
+ # request methods can instead accept a PredictionIO::AsyncResponse object
25
+ # generated from asynchronous request methods as its first argument. In this
26
+ # case, the method will block until a response is received from it.
27
+ #
28
+ # Any network reconnection and request retry is automatically handled in the
29
+ # background. Exceptions will be thrown after a request times out to avoid
30
+ # infinite blocking.
31
+ #
32
+ # == Installation
33
+ # The easiest way is to use RubyGems:
34
+ # gem install predictionio
35
+ #
36
+ # == Synopsis
37
+ # In most cases, using synchronous methods. If you have a special performance
38
+ # requirement, you may want to take a look at asynchronous methods.
39
+ #
40
+ # === Instantiate an EventClient
41
+ # # Include the PredictionIO SDK
42
+ # require 'predictionio'
43
+ #
44
+ # client = PredictionIO::EventClient.new(<app_id>)
45
+ #
46
+ # === Import a User Record from Your App (with asynchronous/non-blocking
47
+ # requests)
48
+ #
49
+ # #
50
+ # # (your user registration logic)
51
+ # #
52
+ #
53
+ # uid = get_user_from_your_db()
54
+ #
55
+ # # PredictionIO call to create user
56
+ # response = client.aset_user(uid)
57
+ #
58
+ # #
59
+ # # (other work to do for the rest of the page)
60
+ # #
61
+ #
62
+ # begin
63
+ # # PredictionIO call to retrieve results from an asynchronous response
64
+ # result = client.set_user(response)
65
+ # rescue PredictionIO::EventClient::NotCreatedError => e
66
+ # log_and_email_error(...)
67
+ # end
68
+ #
69
+ # === Import a User Action (Rate) from Your App (with synchronous/blocking
70
+ # requests)
71
+ # # PredictionIO call to record the view action
72
+ # begin
73
+ # result = client.record_user_action_on_item('rate', 'foouser',
74
+ # 'baritem',
75
+ # 'pio_rating' => 4)
76
+ # rescue PredictionIO::EventClient::NotCreatedError => e
77
+ # ...
78
+ # end
79
+ class EventClient
80
+ # Raised when an event is not created after a synchronous API call.
81
+ class NotCreatedError < StandardError; end
82
+
83
+ # Create a new PredictionIO Event Client with defaults:
84
+ # - 1 concurrent HTTP(S) connections (threads)
85
+ # - API entry point at http://localhost:7070 (apiurl)
86
+ # - a 60-second timeout for each HTTP(S) connection (thread_timeout)
87
+ def initialize(app_id, apiurl = 'http://localhost:7070', threads = 1,
88
+ thread_timeout = 60)
89
+ @app_id = app_id
90
+ @http = PredictionIO::Connection.new(URI(apiurl), threads, thread_timeout)
91
+ end
92
+
93
+ # Returns the number of pending requests within the current client.
94
+ def pending_requests
95
+ @http.packages.size
96
+ end
97
+
98
+ # Returns PredictionIO's status in string.
99
+ def get_status
100
+ status = @http.aget(PredictionIO::AsyncRequest.new('/')).get
101
+ begin
102
+ status.body
103
+ rescue
104
+ status
105
+ end
106
+ end
107
+
108
+ protected
109
+
110
+ # Internal helper method. Do not call directly.
111
+ def sync_events(sync_m, *args)
112
+ if args[0].is_a?(PredictionIO::AsyncResponse)
113
+ response = args[0].get
114
+ else
115
+ response = send(sync_m, *args).get
116
+ end
117
+ return response if response.is_a?(Net::HTTPCreated)
118
+ begin
119
+ msg = response.body
120
+ rescue
121
+ raise NotCreatedError, response
122
+ end
123
+ fail NotCreatedError, msg
124
+ end
125
+
126
+ public
127
+
128
+ # :category: Asynchronous Methods
129
+ # Asynchronously request to create an event and return a
130
+ # PredictionIO::AsyncResponse object immediately.
131
+ #
132
+ # Corresponding REST API method: POST /events.json
133
+ #
134
+ # See also #create_event.
135
+ def acreate_event(event, entity_type, entity_id, optional = {})
136
+ h = optional
137
+ h.key?('eventTime') || h['eventTime'] = DateTime.now.to_s
138
+ h['appId'] = @app_id
139
+ h['event'] = event
140
+ h['entityType'] = entity_type
141
+ h['entityId'] = entity_id
142
+ @http.apost(PredictionIO::AsyncRequest.new('/events.json', h.to_json))
143
+ end
144
+
145
+ # :category: Synchronous Methods
146
+ # Synchronously request to create an event and block until a response is
147
+ # received.
148
+ #
149
+ # See also #acreate_event.
150
+ #
151
+ # call-seq:
152
+ # create_event(event, entity_type, entity_id, optional = {})
153
+ # create_event(async_response)
154
+ def create_event(*args)
155
+ sync_events(:acreate_event, *args)
156
+ end
157
+
158
+ # :category: Asynchronous Methods
159
+ # Asynchronously request to set properties of a user and return a
160
+ # PredictionIO::AsyncResponse object immediately.
161
+ #
162
+ # Corresponding REST API method: POST /events.json
163
+ #
164
+ # See also #set_user.
165
+ def aset_user(uid, optional = {})
166
+ acreate_event('$set', 'pio_user', uid, optional)
167
+ end
168
+
169
+ # :category: Synchronous Methods
170
+ # Synchronously request to set properties of a user and block until a
171
+ # response is received.
172
+ #
173
+ # See also #aset_user.
174
+ #
175
+ # call-seq:
176
+ # set_user(uid, optional = {})
177
+ # set_user(async_response)
178
+ def set_user(*args)
179
+ sync_events(:aset_user, *args)
180
+ end
181
+
182
+ # :category: Asynchronous Methods
183
+ # Asynchronously request to unset properties of a user and return a
184
+ # PredictionIO::AsyncResponse object immediately.
185
+ #
186
+ # properties must be a non-empty Hash.
187
+ #
188
+ # Corresponding REST API method: POST /events.json
189
+ #
190
+ # See also #unset_user.
191
+ def aunset_user(uid, optional)
192
+ optional.key?('properties') ||
193
+ fail(ArgumentError, 'properties must be present when event is $unset')
194
+ optional['properties'].empty? &&
195
+ fail(ArgumentError, 'properties cannot be empty when event is $unset')
196
+ acreate_event('$unset', 'pio_user', uid, optional)
197
+ end
198
+
199
+ # :category: Synchronous Methods
200
+ # Synchronously request to unset properties of a user and block until a
201
+ # response is received.
202
+ #
203
+ # See also #aunset_user.
204
+ #
205
+ # call-seq:
206
+ # unset_user(uid, optional)
207
+ # unset_user(async_response)
208
+ def unset_user(*args)
209
+ sync_events(:aunset_user, *args)
210
+ end
211
+
212
+ # :category: Asynchronous Methods
213
+ # Asynchronously request to delete a user and return a
214
+ # PredictionIO::AsyncResponse object immediately.
215
+ #
216
+ # Corresponding REST API method: POST /events.json
217
+ #
218
+ # See also #delete_user.
219
+ def adelete_user(uid)
220
+ acreate_event('$delete', 'pio_user', uid)
221
+ end
222
+
223
+ # :category: Synchronous Methods
224
+ # Synchronously request to delete a user and block until a response is
225
+ # received.
226
+ #
227
+ # See also #adelete_user.
228
+ #
229
+ # call-seq:
230
+ # delete_user(uid)
231
+ # delete_user(async_response)
232
+ def delete_user(*args)
233
+ sync_events(:adelete_user, *args)
234
+ end
235
+
236
+ # :category: Asynchronous Methods
237
+ # Asynchronously request to set properties of an item and return a
238
+ # PredictionIO::AsyncResponse object immediately.
239
+ #
240
+ # Corresponding REST API method: POST /events.json
241
+ #
242
+ # See also #set_item.
243
+ def aset_item(iid, optional = {})
244
+ acreate_event('$set', 'pio_item', iid, optional)
245
+ end
246
+
247
+ # :category: Synchronous Methods
248
+ # Synchronously request to set properties of an item and block until a
249
+ # response is received.
250
+ #
251
+ # See also #aset_item.
252
+ #
253
+ # call-seq:
254
+ # set_item(iid, properties = {}, optional = {})
255
+ # set_item(async_response)
256
+ def set_item(*args)
257
+ sync_events(:aset_item, *args)
258
+ end
259
+
260
+ # :category: Asynchronous Methods
261
+ # Asynchronously request to unset properties of an item and return a
262
+ # PredictionIO::AsyncResponse object immediately.
263
+ #
264
+ # properties must be a non-empty Hash.
265
+ #
266
+ # Corresponding REST API method: POST /events.json
267
+ #
268
+ # See also #unset_item.
269
+ def aunset_item(iid, optional)
270
+ optional.key?('properties') ||
271
+ fail(ArgumentError, 'properties must be present when event is $unset')
272
+ optional['properties'].empty? &&
273
+ fail(ArgumentError, 'properties cannot be empty when event is $unset')
274
+ acreate_event('$unset', 'pio_item', iid, optional)
275
+ end
276
+
277
+ # :category: Synchronous Methods
278
+ # Synchronously request to unset properties of an item and block until a
279
+ # response is received.
280
+ #
281
+ # See also #aunset_item.
282
+ #
283
+ # call-seq:
284
+ # unset_item(iid, properties, optional = {})
285
+ # unset_item(async_response)
286
+ def unset_item(*args)
287
+ sync_events(:aunset_item, *args)
288
+ end
289
+
290
+ # :category: Asynchronous Methods
291
+ # Asynchronously request to delete an item and return a
292
+ # PredictionIO::AsyncResponse object immediately.
293
+ #
294
+ # Corresponding REST API method: POST /events.json
295
+ #
296
+ # See also #delete_item.
297
+ def adelete_item(uid)
298
+ acreate_event('$delete', 'pio_item', uid)
299
+ end
300
+
301
+ # :category: Synchronous Methods
302
+ # Synchronously request to delete an item and block until a response is
303
+ # received.
304
+ #
305
+ # See also #adelete_item.
306
+ #
307
+ # call-seq:
308
+ # delete_item(uid)
309
+ # delete_item(async_response)
310
+ def delete_item(*args)
311
+ sync_events(:adelete_item, *args)
312
+ end
313
+
314
+ # :category: Asynchronous Methods
315
+ # Asynchronously request to record an action on an item and return a
316
+ # PredictionIO::AsyncResponse object immediately.
317
+ #
318
+ # Corresponding REST API method: POST /events.json
319
+ #
320
+ # See also #record_user_action_on_item.
321
+ def arecord_user_action_on_item(action, uid, iid, optional = {})
322
+ optional['targetEntityType'] = 'pio_item'
323
+ optional['targetEntityId'] = iid
324
+ acreate_event(action, 'pio_user', uid, optional)
325
+ end
326
+
327
+ # :category: Synchronous Methods
328
+ # Synchronously request to record an action on an item and block until a
329
+ # response is received.
330
+ #
331
+ # See also #arecord_user_action_on_item.
332
+ #
333
+ # call-seq:
334
+ # record_user_action_on_item(action, uid, iid, optional = {})
335
+ # record_user_action_on_item(async_response)
336
+ def record_user_action_on_item(*args)
337
+ sync_events(:arecord_user_action_on_item, *args)
338
+ end
339
+ end
340
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: predictionio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
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-05-10 00:00:00.000000000 Z
11
+ date: 2014-09-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  PredictionIO is a prediction server for building smart applications. This gem
@@ -19,13 +19,16 @@ executables: []
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
+ - lib/predictionio.rb
22
23
  - lib/predictionio/async_request.rb
23
24
  - lib/predictionio/async_response.rb
24
25
  - lib/predictionio/client.rb
25
26
  - lib/predictionio/connection.rb
26
- - lib/predictionio.rb
27
+ - lib/predictionio/engine_client.rb
28
+ - lib/predictionio/event_client.rb
27
29
  homepage: http://prediction.io
28
- licenses: []
30
+ licenses:
31
+ - Apache-2.0
29
32
  metadata: {}
30
33
  post_install_message:
31
34
  rdoc_options: []
@@ -33,17 +36,17 @@ require_paths:
33
36
  - lib
34
37
  required_ruby_version: !ruby/object:Gem::Requirement
35
38
  requirements:
36
- - - '>='
39
+ - - ">="
37
40
  - !ruby/object:Gem::Version
38
41
  version: '1.9'
39
42
  required_rubygems_version: !ruby/object:Gem::Requirement
40
43
  requirements:
41
- - - '>='
44
+ - - ">="
42
45
  - !ruby/object:Gem::Version
43
46
  version: '0'
44
47
  requirements: []
45
48
  rubyforge_project:
46
- rubygems_version: 2.0.14
49
+ rubygems_version: 2.2.2
47
50
  signing_key:
48
51
  specification_version: 4
49
52
  summary: PredictionIO Ruby SDK