Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #16 from habuma/master

SOCIALTW-29: Added retweeted property to Tweet object.
  • Loading branch information...
commit 7b0500e444cb9085a12c2034dbcef50fc0336c5c 2 parents ae83851 + 71cb7d9
@habuma habuma authored
View
9 spring-social-twitter/src/main/java/org/springframework/social/twitter/api/Tweet.java
@@ -33,6 +33,7 @@
private String languageCode;
private String source;
private Integer retweetCount;
+ private boolean retweeted;
public Tweet(long id, String text, Date createdAt, String fromUser, String profileImageUrl, Long toUserId, long fromUserId, String languageCode, String source) {
this.id = id;
@@ -138,4 +139,12 @@ public void setRetweetCount(Integer retweetCount) {
public Integer getRetweetCount() {
return retweetCount;
}
+
+ public void setRetweeted(boolean retweeted) {
+ this.retweeted = retweeted;
+ }
+
+ public boolean isRetweeted() {
+ return retweeted;
+ }
}
View
3  spring-social-twitter/src/main/java/org/springframework/social/twitter/api/impl/TweetDeserializer.java
@@ -69,6 +69,9 @@ public Tweet deserialize(JsonParser jp, DeserializationContext ctxt) throws IOEx
JsonNode retweetCountNode = tree.get("retweet_count");
Integer retweetCount = retweetCountNode != null && !retweetCountNode.isNull() ? retweetCountNode.getIntValue() : null;
tweet.setRetweetCount(retweetCount);
+ JsonNode retweetedNode = tree.get("retweeted");
+ boolean retweeted = retweetedNode != null && !retweetedNode.isNull() ? retweetedNode.getBooleanValue() : false;
+ tweet.setRetweeted(retweeted);
jp.skipChildren();
return tweet;
}
View
3  spring-social-twitter/src/test/java/org/springframework/social/twitter/api/impl/AbstractTwitterApiTest.java
@@ -64,9 +64,10 @@ protected void assertSingleTweet(Tweet tweet, boolean isSearchResult) {
assertEquals("http://a3.twimg.com/profile_images/1205746571/me2_300.jpg", tweet.getProfileImageUrl());
assertEquals("Spring Social Showcase", tweet.getSource());
assertEquals(1279042701000L, tweet.getCreatedAt().getTime());
- assertEquals(Long.valueOf(123123123123L), tweet.getInReplyToStatusId());
+ assertEquals(Long.valueOf(123123123123L), tweet.getInReplyToStatusId());
if (!isSearchResult) {
assertEquals(12, tweet.getRetweetCount().intValue());
+ assertTrue(tweet.isRetweeted());
} else {
assertNull(tweet.getRetweetCount());
}
View
3  spring-social-twitter/src/test/java/org/springframework/social/twitter/api/impl/favorite.json
@@ -11,7 +11,8 @@
"source" : "Spring Social Showcase",
"in_reply_to_user_id" : "332211",
"retweet_count" : 12,
- "created_at" : "Tue Jul 13 17:38:21 +0000 2010"
+ "created_at" : "Tue Jul 13 17:38:21 +0000 2010",
+ "retweeted" : true
},
{
"id" : "54321",
View
3  spring-social-twitter/src/test/java/org/springframework/social/twitter/api/impl/status.json
@@ -10,5 +10,6 @@
"source" : "Spring Social Showcase",
"in_reply_to_user_id" : "332211",
"retweet_count" : 12,
- "created_at" : "Tue Jul 13 17:38:21 +0000 2010"
+ "created_at" : "Tue Jul 13 17:38:21 +0000 2010",
+ "retweeted" : true
}
View
3  spring-social-twitter/src/test/java/org/springframework/social/twitter/api/impl/timeline.json
@@ -11,7 +11,8 @@
"in_reply_to_user_id" : "332211",
"retweet_count" : 12,
"in_reply_to_status_id" : 123123123123,
- "created_at" : "Tue Jul 13 17:38:21 +0000 2010"
+ "created_at" : "Tue Jul 13 17:38:21 +0000 2010",
+ "retweeted" : true
},
{
"id" : 54321,
Please sign in to comment.
Something went wrong with that request. Please try again.