Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ build

!*.prefs
!*.classpath
!*.project
!*.project

.idea
*.iml
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'idea'
apply plugin: 'eclipse'

group = 'com.trulioo'
version = '1.0.0'
version = '1.1.0-UT'

buildscript {
repositories {
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>normalizedapi</artifactId>
<packaging>jar</packaging>
<name>Trulioo Normalized API</name>
<version>1.0.1</version>
<version>1.1.0-UT</version>
<url>https://api.globaldatacompany.com/docs</url>
<description>Trulioo provides a collection of API methods to help you build business processes powered by the GlobalGateway Normalized API.</description>
<scm>
Expand Down
28 changes: 27 additions & 1 deletion src/main/java/com/trulioo/normalizedapi/JSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: v1
*
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
Expand Down Expand Up @@ -37,6 +37,8 @@
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;

import javax.xml.bind.DatatypeConverter;

public class JSON {
private ApiClient apiClient;
private Gson gson;
Expand All @@ -52,6 +54,7 @@ public JSON(ApiClient apiClient) {
.registerTypeAdapter(Date.class, new DateAdapter(apiClient))
.registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter())
.registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter())
.registerTypeAdapter(byte[].class, new ByteArrayTypeAdapter())
.create();
}

Expand Down Expand Up @@ -223,3 +226,26 @@ public LocalDate read(JsonReader in) throws IOException {
}
}
}

class ByteArrayTypeAdapter extends TypeAdapter<byte[]> {
@Override
public void write(JsonWriter out, byte[] value) throws IOException {
if (value == null) {
out.nullValue();
} else {
out.value(DatatypeConverter.printBase64Binary(value));
}
}

@Override
public byte[] read(JsonReader in) throws IOException {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String value = in.nextString();
return DatatypeConverter.parseBase64Binary(value);
}
}
}