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
20 changes: 18 additions & 2 deletions src/main/java/com/tumblr/jumblr/types/Blog.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Blog extends Resource {
private String name;
private String title;
private String description;
private int posts, likes, followers;
private int posts, likes, followers, drafts, queue;
private Long updated;
private boolean ask, ask_anon;

Expand Down Expand Up @@ -56,6 +56,22 @@ public Integer getLikeCount() {
return this.likes;
}

/**
* Get the number of drafts for this blog
* @return int the number of drafts
*/
public Integer getDraftCount() {
return this.drafts;
}

/**
* Get the number of Queued Posts for this blog
* @return int the number of Queued Posts
*/
public Integer getQueuedCount() {
return this.queue;
}

/**
* Get the time of the most recent post (in seconds since epoch)
* @return Long of time
Expand Down Expand Up @@ -211,4 +227,4 @@ public void setName(String name) {
this.name = name;
}

}
}
18 changes: 18 additions & 0 deletions src/main/java/com/tumblr/jumblr/types/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,22 @@ public void setDate(Date date) {
setDate(df.format(date));
}

/**
* Set the source title for this post
* @param string source title
*/
public void setSourceTitle(String title) {
this.source_title = title;
}

/**
* Set the source URL for this post
* @param string value of the source URL
*/
public void setSourceUrl(String urlString) {
this.source_url = urlString;
}

/**
* Set the state for this post
* @param state the state
Expand Down Expand Up @@ -430,6 +446,8 @@ protected Map<String, Object> detail() {
map.put("slug", slug);
map.put("date", date);
map.put("type", getType().getValue());
map.put("source_url", source_url);
map.put("source_title", source_title);
return map;
}

Expand Down
9 changes: 8 additions & 1 deletion src/main/java/com/tumblr/jumblr/types/VideoPost.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class VideoPost extends Post {

private List<Video> player;
private String caption;
private String embed, permalink_url;
private String embed, permalink_url, video_url;
private File data;
private String thumbnail_url;
private int thumbnail_width;
Expand All @@ -25,6 +25,13 @@ public String getPermalinkUrl() {
return permalink_url;
}

/**
* Get the direct URL for this video
*/
public String getVideoUrl() {
return video_url;
}

/**
* Get the thumbnail URL for the video
* @return possibly null URL
Expand Down
6 changes: 5 additions & 1 deletion src/test/java/com/tumblr/jumblr/types/BlogTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class BlogTest extends TypeTest {
Blog blog;

private String name = "name.com", title = "title", description = "desc";
private Integer posts = 10, likes = 11, followers = 10;
private Integer posts = 10, likes = 11, followers = 10, drafts = 9, queue = 8;
private Long updated = 123456L;
private Boolean ask = false, ask_anon = true;

Expand All @@ -37,6 +37,8 @@ public void setup() throws IOException {
flat.put("ask", ask);
flat.put("ask_anon", ask_anon);
flat.put("followers", followers);
flat.put("drafts", drafts);
flat.put("queue", queue);

Gson gson = new Gson();
blog = gson.fromJson(flatSerialize(flat), Blog.class);
Expand All @@ -62,6 +64,8 @@ public void testReaders() {
assertEquals(title, blog.getTitle());
assertEquals(name, blog.getName());
assertEquals(followers, blog.getFollowersCount());
assertEquals(drafts, blog.getDraftCount());
assertEquals(queue, blog.getQueuedCount());
}

@Test
Expand Down