Skip to content

Commit bf58fb6

Browse files
committed
Fixed setting item values of timestamp properties
1 parent d5e4e28 commit bf58fb6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.recombee</groupId>
88
<artifactId>api-client</artifactId>
9-
<version>1.2.4</version>
9+
<version>1.2.4.1</version>
1010
<name>Recombee API Client</name>
1111
<description>A client library for easy use of the Recombee recommendation API</description>
1212
<url>http://recombee.com</url>
@@ -29,7 +29,7 @@
2929
<developer>
3030
<id>ondra_fiedler</id>
3131
<name>Ondrej Fiedler</name>
32-
<email>ondrj[email protected]</email>
32+
<email>ondrej[email protected]</email>
3333
<url>https://github.com/OndraFiedler</url>
3434
<organization>Recombee</organization>
3535
<organizationUrl>http://recombee.com</organizationUrl>

src/main/java/com/recombee/api_client/RecombeeClient.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import com.fasterxml.jackson.core.JsonProcessingException;
44
import com.fasterxml.jackson.databind.ObjectMapper;
55
import com.fasterxml.jackson.core.type.TypeReference;
6+
import java.text.SimpleDateFormat;
7+
68
import com.mashape.unirest.http.HttpResponse;
79
import com.mashape.unirest.http.Unirest;
810
import com.mashape.unirest.http.exceptions.UnirestException;
@@ -73,6 +75,8 @@ public RecombeeClient(String databaseId, String token) {
7375
this.databaseId = databaseId;
7476
this.token = token;
7577
this.mapper = new ObjectMapper();
78+
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
79+
this.mapper.setDateFormat(df);
7680

7781
if (System.getenv("RAPI_URI") != null)
7882
this.baseUri = System.getenv("RAPI_URI");
@@ -605,7 +609,7 @@ private HttpRequest delete(String url) {
605609

606610
private HttpRequest post(String url, Request req) {
607611
try {
608-
String json = new ObjectMapper().writeValueAsString(req.getBodyParameters());
612+
String json = this.mapper.writeValueAsString(req.getBodyParameters());
609613
return Unirest.post(url).header("Content-Type", "application/json").
610614
body(json.getBytes()).getHttpRequest();
611615
} catch (JsonProcessingException e) {

0 commit comments

Comments
 (0)