Skip to content

Commit 4aa21d2

Browse files
author
boncey
committed
Get timezone_id from people.getInfo response. Fix #152
1 parent e4e3b67 commit 4aa21d2

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

Flickr4Java/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ public User getInfo(String userId) throws FlickrException {
180180
TimeZone tz = new TimeZone();
181181
user.setTimeZone(tz);
182182
tz.setLabel(tzElement.getAttribute("label"));
183+
tz.setTimeZoneId(tzElement.getAttribute("timezone_id"));
183184
tz.setOffset(tzElement.getAttribute("offset"));
184185
}
185186

Flickr4Java/src/main/java/com/flickr4java/flickr/people/TimeZone.java

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
public class TimeZone {
44

5-
private String label;
5+
private String label;
66

77
private String offset;
88

9+
private String timeZoneId;
10+
911
/**
1012
* Time Zone text
1113
*
12-
* @return timezone
14+
* @return the label
1315
*/
1416
public String getLabel() {
1517
return label;
@@ -24,12 +26,33 @@ public void setLabel(String label) {
2426
*
2527
* @return timezone offset value
2628
*/
29+
public String getOffset() {
30+
return offset;
31+
}
32+
33+
/**
34+
* @deprecated typo in method name, use {@link #getOffset()}.
35+
*/
36+
@Deprecated
2737
public String geOffset() {
2838
return offset;
2939
}
3040

3141
public void setOffset(String offset) {
3242
this.offset = offset;
3343
}
34-
44+
45+
/**
46+
* Time Zone id
47+
*
48+
* @return timezone_id offset value
49+
*/
50+
public String getTimeZoneId() {
51+
return timeZoneId;
52+
}
53+
54+
public void setTimeZoneId(String id) {
55+
this.timeZoneId = id;
56+
}
57+
3558
}

Flickr4Java/src/test/java/com/flickr4java/flickr/test/PeopleInterfaceTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ public void testGetInfo() throws FlickrException {
6060
assertEquals(person.getPhotosurl(), String.format("https://www.flickr.com/photos/%s/", testProperties.getUsername()));
6161
assertEquals(person.getProfileurl(), String.format("https://www.flickr.com/people/%s/", testProperties.getUsername()));
6262
assertTrue(person.getSecureBuddyIconUrl().startsWith("https://"));
63+
assertNotNull(person.getTimeZone());
64+
assertNotNull(person.getTimeZone().getTimeZoneId());
65+
assertNotNull(person.getTimeZone().getOffset());
66+
assertNotNull(person.getTimeZone().getLabel());
6367
}
6468

6569
@Test

0 commit comments

Comments
 (0)