You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@predictionio.apache.org by shouya <gi...@git.apache.org> on 2017/07/24 06:49:30 UTC

[GitHub] incubator-predictionio-sdk-ruby pull request #21: Normalize eventTime format...

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 <sh...@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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-predictionio-sdk-ruby pull request #21: Normalize eventTime format...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---

[GitHub] incubator-predictionio-sdk-ruby issue #21: Normalize eventTime format to iso...

Posted by dszeto <gi...@git.apache.org>.
Github user dszeto commented on the issue:

    https://github.com/apache/incubator-predictionio-sdk-ruby/pull/21
  
    Thanks for the fix @shouya ! Sorry that it took a bit to merge.


---