-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #619 from topero/feature/support-for-list-locales-…
…operation Support List Locales operation
- Loading branch information
Showing
5 changed files
with
156 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package org.zendesk.client.v2.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.io.Serializable; | ||
import java.util.Date; | ||
|
||
/** | ||
* See <a | ||
* href="https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/"> | ||
* Locales in Zendesk API </a> | ||
* | ||
* @since FIXME | ||
*/ | ||
public class Locale implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
private Date createdAt; | ||
private Long id; | ||
private String locale; | ||
private String name; | ||
private Date updatedAt; | ||
private String url; | ||
|
||
@JsonProperty("created_at") | ||
public Date getCreatedAt() { | ||
return createdAt; | ||
} | ||
|
||
public void setCreatedAt(Date createdAt) { | ||
this.createdAt = createdAt; | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public String getLocale() { | ||
return locale; | ||
} | ||
|
||
public void setLocale(String locale) { | ||
this.locale = locale; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
@JsonProperty("updated_at") | ||
public Date getUpdatedAt() { | ||
return updatedAt; | ||
} | ||
|
||
public void setUpdatedAt(Date updatedAt) { | ||
this.updatedAt = updatedAt; | ||
} | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public void setUrl(String url) { | ||
this.url = url; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Locale{" | ||
+ "createdAt=" | ||
+ createdAt | ||
+ ", id=" | ||
+ id | ||
+ ", locale='" | ||
+ locale | ||
+ '\'' | ||
+ ", name='" | ||
+ name | ||
+ '\'' | ||
+ ", updatedAt=" | ||
+ updatedAt | ||
+ ", url='" | ||
+ url | ||
+ '\'' | ||
+ '}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.zendesk.client.v2.model; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
import org.junit.Test; | ||
import org.zendesk.client.v2.Zendesk; | ||
|
||
public class LocaleTest { | ||
@Test | ||
public void testLocaleDeserialization() throws Exception { | ||
String json = | ||
"{" | ||
+ "\"url\": \"https://acme.zendesk.com/api/v2/locales/en-US.json\"," | ||
+ "\"id\": 1," | ||
+ "\"locale\": \"en-US\"," | ||
+ "\"name\": \"English\"," | ||
+ "\"created_at\": \"2023-08-13T19:23:16Z\"," | ||
+ "\"updated_at\": \"2023-09-21T19:23:16Z\"" | ||
+ "}"; | ||
|
||
Locale locale = Zendesk.createMapper().readValue(json, Locale.class); | ||
|
||
assertThat(locale.getUrl(), is("https://acme.zendesk.com/api/v2/locales/en-US.json")); | ||
assertThat(locale.getId(), is(1L)); | ||
assertThat(locale.getLocale(), is("en-US")); | ||
assertThat(locale.getName(), is("English")); | ||
assertThat(locale.getCreatedAt().getTime(), is(1691954596000L)); | ||
assertThat(locale.getUpdatedAt().getTime(), is(1695324196000L)); | ||
} | ||
} |