You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@predictionio.apache.org by do...@apache.org on 2017/06/05 20:17:12 UTC

incubator-predictionio-sdk-ruby git commit: Enable create event in batch

Repository: incubator-predictionio-sdk-ruby
Updated Branches:
  refs/heads/develop 131f9491d -> 92ba576f5


Enable create event in batch

Closes #20


Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio-sdk-ruby/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio-sdk-ruby/commit/92ba576f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio-sdk-ruby/tree/92ba576f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio-sdk-ruby/diff/92ba576f

Branch: refs/heads/develop
Commit: 92ba576f539039cd500710df8364fde8b282ae7d
Parents: 131f949
Author: Khairul Fahmi <ky...@gmail.com>
Authored: Mon Jun 5 13:16:47 2017 -0700
Committer: Donald Szeto <ds...@salesforce.com>
Committed: Mon Jun 5 13:16:47 2017 -0700

----------------------------------------------------------------------
 lib/predictionio/event_client.rb | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-predictionio-sdk-ruby/blob/92ba576f/lib/predictionio/event_client.rb
----------------------------------------------------------------------
diff --git a/lib/predictionio/event_client.rb b/lib/predictionio/event_client.rb
index f024db9..2fda24e 100644
--- a/lib/predictionio/event_client.rb
+++ b/lib/predictionio/event_client.rb
@@ -120,6 +120,19 @@ module PredictionIO
       ))
     end
 
+    # :category: Asynchronous Methods
+    # Asynchronously request to create a batch of event and return a
+    # PredictionIO::AsyncResponse object immediately.
+    #
+    # Corresponding REST API method: POST /batch/events.json
+    #
+    # See also #acreate_event.
+    def acreate_batch_event(payload)
+      @http.apost(PredictionIO::AsyncRequest.new(
+        "/batch/events.json?accessKey=#{@access_key}", payload.to_json
+      ))
+    end
+
     # :category: Synchronous Methods
     # Synchronously request to create an event and block until a response is
     # received.
@@ -133,6 +146,19 @@ module PredictionIO
       sync_events(:acreate_event, *args)
     end
 
+    # :category: Synchronous Methods
+    # Synchronously request to create an event and block until a response is
+    # received.
+    #
+    # See also #acreate_event.
+    #
+    # call-seq:
+    # create_batch_event(payload)
+    # create_batch_event(async_response)
+    def create_batch_event(payload)
+      sync_events(:acreate_batch_event, payload)
+    end
+
     # :category: Asynchronous Methods
     # Asynchronously request to set properties of a user and return a
     # PredictionIO::AsyncResponse object immediately.