Skip to content

Commit

Permalink
Merge branch 'release/2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
roundrop committed Oct 13, 2014
2 parents 8e15641 + 6c654dd commit 8542301
Show file tree
Hide file tree
Showing 38 changed files with 2,000 additions and 46 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: java
jdk:
- openjdk6
cache:
directories:
- $HOME/.m2
before_script:
- echo "debug=false" >> facebook4j-core/src/test/resources/test.properties && echo "oauth.appId=1" >> facebook4j-core/src/test/resources/test.properties && echo "oauth.appSecret=1" >> facebook4j-core/src/test/resources/test.properties && echo "oauth.accessToken=access_token" >> facebook4j-core/src/test/resources/test.properties
after_success:
- mvn -pl facebook4j-core clean cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:cobertura
18 changes: 18 additions & 0 deletions facebook4j-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,24 @@
<excludedGroups>facebook4j.junit.category.RealAPITests</excludedGroups>
</configuration>
</plugin>

<!-- for Coveralls -->
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>2.2.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<format>xml</format>
<maxmem>256m</maxmem>
<aggregate>true</aggregate>
<check/>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
* @author Ryuji Yamashita - roundrop at gmail.com
*/
public interface InboxResponseList<T> extends ResponseList<T> {
InboxResponseList.Summary getSummary();
InboxSummary getInboxSummary();

interface Summary {
interface InboxSummary {
Integer getUnseenCount();
Integer getUnreadCount();
Date getUpdatedTime();
Expand Down
2 changes: 2 additions & 0 deletions facebook4j-core/src/main/java/facebook4j/Page.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ public interface Page {
Boolean isCommunityPage();
Integer getWereHereCount();
Date getCreatedTime();
String getAbout();
String getUsername();
}
2 changes: 2 additions & 0 deletions facebook4j-core/src/main/java/facebook4j/Place.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@

package facebook4j;

import java.util.List;

/**
* @author Ryuji Yamashita - roundrop at gmail.com
*/
public interface Place extends FacebookResponse {
String getId();
String getName();
List<Category> getCategories();
Place.Location getLocation();

interface Location {
Expand Down
1 change: 1 addition & 0 deletions facebook4j-core/src/main/java/facebook4j/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public interface Post extends FacebookResponse {
String getMessage();
List<Tag> getMessageTags();
URL getPicture();
URL getFullPicture();
URL getLink();
String getName();
String getCaption();
Expand Down
10 changes: 9 additions & 1 deletion facebook4j-core/src/main/java/facebook4j/Reading.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,15 @@ public Reading withLocation() {
parameterMap.put("with", "location");
return this;
}


public Reading summary() {
if (parameterMap.containsKey("summary")) {
throw new IllegalStateException("'summary' already sets");
}
parameterMap.put("summary", "true");
return this;
}

public Reading filter(String filterName) {
if (filterName == null) {
throw new NullPointerException("filterName is null");
Expand Down
1 change: 1 addition & 0 deletions facebook4j-core/src/main/java/facebook4j/ResponseList.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
* @author Ryuji Yamashita - roundrop at gmail.com
*/
public interface ResponseList<T> extends PagableList<T> {
Summary getSummary();
}
41 changes: 41 additions & 0 deletions facebook4j-core/src/main/java/facebook4j/Summary.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2012 Ryuji Yamashita
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package facebook4j;

/**
* @author Ryuji Yamashita - roundrop at gmail.com
* @since Facebook4J 2.2.0
*/
public interface Summary {
SummaryOrder getOrder();
Integer getTotalCount();

public enum SummaryOrder {
ranked,
chronological,
;
public static SummaryOrder getInstance(String logic) {
for (SummaryOrder so : SummaryOrder.values()) {
if (so.toString().equals(logic.toLowerCase())) {
return so;
}
}
//throw new IllegalArgumentException();
return null;
}
}
}
2 changes: 1 addition & 1 deletion facebook4j-core/src/main/java/facebook4j/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @author Ryuji Yamashita - roundrop at gmail.com
*/
public final class Version {
private static final String VERSION = "2.1.0";
private static final String VERSION = "2.2.0";
private static final String TITLE = "Facebook4J";

private Version() {
Expand Down
3 changes: 1 addition & 2 deletions facebook4j-core/src/main/java/facebook4j/VideoUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package facebook4j;

import facebook4j.internal.http.HttpParameter;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -108,7 +107,7 @@ public VideoUpdate scheduledPublishTime(Date scheduledPublishTime) {

/*package*/ HttpParameter[] asHttpParameterArray() {
List<HttpParameter> params = new ArrayList<HttpParameter>();
params.add(new HttpParameter("source", source.getMediaFile()));
params.add(source.asHttpParameter("source"));
if (title != null) {
params.add(new HttpParameter("title", title));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@

package facebook4j.internal.json;

import static facebook4j.internal.util.z_F4JInternalParseUtil.*;

import java.util.Date;

import facebook4j.Category;
import facebook4j.FacebookException;
import facebook4j.conf.Configuration;
import facebook4j.internal.http.HttpResponse;
import facebook4j.internal.org.json.JSONObject;

import java.util.Date;

import static facebook4j.internal.util.z_F4JInternalParseUtil.*;

/**
* @author Ryuji Yamashita - roundrop at gmail.com
*/
Expand Down Expand Up @@ -101,7 +101,7 @@ public boolean equals(Object obj) {

@Override
public String toString() {
return "CategorizedEntityJSONImpl [id=" + id + ", name=" + name + ", category="
return "CategoryJSONImpl [id=" + id + ", name=" + name + ", category="
+ category + ", createdTime=" + createdTime + "]";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@

package facebook4j.internal.json;

import java.util.Date;

import static facebook4j.internal.util.z_F4JInternalParseUtil.*;
import facebook4j.FacebookException;
import facebook4j.InboxResponseList;
import facebook4j.internal.org.json.JSONException;
import facebook4j.internal.org.json.JSONObject;

import java.util.Date;

import static facebook4j.internal.util.z_F4JInternalParseUtil.*;

public class InboxResponseListImpl<T> extends ResponseListImpl<T> implements InboxResponseList<T> {
private static final long serialVersionUID = -392100352680662139L;

private InboxResponseList.Summary summary;
private InboxSummary inboxSummary;

/*package*/InboxResponseListImpl(JSONObject json, T... t) throws FacebookException {
super(json, t);
Expand All @@ -43,32 +44,32 @@ private void init(JSONObject json) throws FacebookException {
try {
if (!json.isNull("summary")) {
JSONObject summaryJSONObject = json.getJSONObject("summary");
summary = new SummaryJSONImpl(summaryJSONObject);
inboxSummary = new InboxSummaryJSONImpl(summaryJSONObject);
}
} catch (JSONException jsone) {
throw new FacebookException(jsone.getMessage(), jsone);
}
}

public InboxResponseList.Summary getSummary() {
return summary;
public InboxSummary getInboxSummary() {
return inboxSummary;
}

@Override
public String toString() {
return "InboxResponseListImpl [summary=" + summary + "]";
return "InboxResponseListImpl [summary=" + inboxSummary + "]";
}



private class SummaryJSONImpl implements InboxResponseList.Summary, java.io.Serializable {
private class InboxSummaryJSONImpl implements InboxSummary, java.io.Serializable {
private static final long serialVersionUID = 1988071486977638655L;

private Integer unseenCount;
private Integer unreadCount;
private Date updatedTime;

public SummaryJSONImpl(JSONObject json) throws FacebookException {
public InboxSummaryJSONImpl(JSONObject json) throws FacebookException {
if (!json.isNull("unseen_count")) {
unseenCount = getPrimitiveInt("unseen_count", json);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@

package facebook4j.internal.json;

import facebook4j.Cover;
import facebook4j.FacebookException;
import facebook4j.Page;
import facebook4j.Place;
import facebook4j.ResponseList;
import facebook4j.*;
import facebook4j.conf.Configuration;
import facebook4j.internal.http.HttpResponse;
import facebook4j.internal.org.json.JSONArray;
Expand All @@ -34,10 +30,10 @@

/**
* @author Ryuji Yamashita - roundrop at gmail.com
* @since Facebook4J 1.2.0
* @since Facebook4J 2.0.0
*/
/*package*/ final class PageJSONImpl extends FacebookResponseImpl implements Page, java.io.Serializable {
private static final long serialVersionUID = 2058194827423191616L;
private static final long serialVersionUID = -5784064954222183184L;

private String id;
private String name;
Expand All @@ -58,6 +54,8 @@
private String accessToken;
private Boolean isCommunityPage;
private Integer wereHereCount;
private String about;
private String username;

/*package*/PageJSONImpl(HttpResponse res, Configuration conf) throws FacebookException {
super(res);
Expand Down Expand Up @@ -100,6 +98,8 @@ private void init(JSONObject json) throws FacebookException {
accessToken = getRawString("access_token", json);
isCommunityPage = getBoolean("is_community_page", json);
wereHereCount = getInt("were_here_count", json);
about = getRawString("about", json);
username = getRawString("username", json);

} catch (JSONException jsone) {
throw new FacebookException(jsone.getMessage(), jsone);
Expand Down Expand Up @@ -178,6 +178,14 @@ public Integer getWereHereCount() {
return wereHereCount;
}

public String getAbout() {
return about;
}

public String getUsername() {
return username;
}

/*package*/
static ResponseList<Page> createPageList(HttpResponse res, Configuration conf) throws FacebookException {
try {
Expand Down Expand Up @@ -228,7 +236,7 @@ public String toString() {
+ ", accessToken=" + accessToken + ", isCommunityPage="
+ isCommunityPage + ", wereHereCount=" + wereHereCount
+ ", id=" + id + ", name=" + name + ", category=" + category
+ ", createdTime=" + createdTime + "]";
+ ", createdTime=" + createdTime + ", about=" + about + ", username=" + username + "]";
}

}
Loading

0 comments on commit 8542301

Please sign in to comment.