predictionio-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From don...@apache.org
Subject [01/13] incubator-predictionio-sdk-ruby git commit: Enable create event in batch
Date Thu, 26 Oct 2017 05:38:05 GMT
Repository: incubator-predictionio-sdk-ruby
Updated Branches:
  refs/heads/master 131f9491d -> a81a509b2


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/master
Commit: 92ba576f539039cd500710df8364fde8b282ae7d
Parents: 131f949
Author: Khairul Fahmi <kyu.helf@gmail.com>
Authored: Mon Jun 5 13:16:47 2017 -0700
Committer: Donald Szeto <dszeto@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.


Mime
View raw message