GitHub user shouya opened a pull request:

    https://github.com/apache/incubator-predictionio-sdk-ruby/pull/21

    Normalize eventTime format to iso8601

    According to the [PredictionIO EventServer 
documentation](https://predictionio.incubator.apache.org/datacollection/eventapi/#event-creation-api).
 The time must be in ISO8601 format, otherwise the event will not be 
successfully created.
    
    Before:
    
    ```ruby
    [9] pry(main)> x = PIO::EventClient.set_user(111)
      HTTP POST (29.63ms)   
http://192.168.20.4:7070/events.json?accessKey=<masked>
      Request body   {"eventTime":"2017-07-24 
14:43:26","event":"$set","entityType":"user","entityId":111}
      Response status   Net::HTTPBadRequest (400)
      Response body   {"message":"org.json4s.package$MappingException: Fail to 
extract eventTime 2017-07-24 14:43:26"}
    PredictionIO::EventClient::NotCreatedError: 
{"message":"org.json4s.package$MappingException: Fail to extract eventTime 
2017-07-24 14:43:26"}
    from 
/Users/shou/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/predictionio-0.9.6/lib/predictionio/event_client.rb:333:in
 `sync_events'
    ```
    
    Where it should be:
    
    ```ruby
    [10] pry(main)> x = PIO::EventClient.set_user(111, 'eventTime' => 
Time.now.iso8601)
      HTTP POST (90.27ms)   
http://192.168.20.4:7070/events.json?accessKey=<masked>
      Request body   
{"eventTime":"2017-07-24T14:43:48+08:00","event":"$set","entityType":"user","entityId":111}
      Response status   Net::HTTPCreated (201)
      Response body   {"eventId":"Kmgu6x9SvJQtjsepaRECjAAAAV1zVmSghsZcqOIsot8"}
    => #<Net::HTTPCreated 201 Created readbody=true>
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/shouya/incubator-predictionio-sdk-ruby patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-predictionio-sdk-ruby/pull/21.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #21
    
----
commit ee67e6a9477f3e08640c1954bf65f65a93251794
Author: Shou Ya <sho...@users.noreply.github.com>
Date:   2017-07-24T06:44:37Z

    Update event_client.rb

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to