Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

cleanup and improvement #242

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
public interface Facebook extends GraphApi, ApiBinding {

public static final String DEFAULT_API_VERSION = "2.10";
String DEFAULT_API_VERSION = "2.10";

/**
* API for working with achievements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
public interface OpenGraphOperations {

static final ActionMetadata EMPTY_ACTION_METADATA = new ActionMetadata();
ActionMetadata EMPTY_ACTION_METADATA = new ActionMetadata();

/**
* @return Operations for working with built-in general OpenGraph actions such as "og.like" and "og.follow".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,6 @@ public interface UserOperations {
*/
PagedList<Reference> search(String query);

static final String[] PROFILE_FIELDS = {
"id", "about", "age_range", "birthday", "context", "cover", "currency", "devices", "education", "email",
"favorite_athletes", "favorite_teams", "first_name", "gender", "hometown", "inspirational_people", "installed", "install_type",
"is_verified", "languages", "last_name", "link", "locale", "location", "meeting_for", "middle_name", "name", "name_format",
"political", "quotes", "payment_pricepoints", "relationship_status", "religion", "security_settings", "significant_other",
"sports", "test_group", "timezone", "third_party_id", "updated_time", "verified", "video_upload_limits", "viewer_can_send_gift",
"website", "work"
};


}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import org.springframework.social.MissingAuthorizationException;

class AbstractFacebookOperations {
public class AbstractFacebookOperations {

private final boolean isAuthorized;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

class CommentTemplate implements CommentOperations {
public class CommentTemplate implements CommentOperations {

private final GraphApi graphApi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

class EventTemplate implements EventOperations {
public class EventTemplate implements EventOperations {

private final GraphApi graphApi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* Graph API, interpreting them into appropriate exceptions.
* @author Craig Walls
*/
class FacebookErrorHandler extends DefaultResponseErrorHandler {
public class FacebookErrorHandler extends DefaultResponseErrorHandler {

private static final String FACEBOOK_PROVIDER_ID = "facebook";
private final static Log logger = LogFactory.getLog(FacebookErrorHandler.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;

class FeedTemplate implements FeedOperations {
public class FeedTemplate implements FeedOperations {

private static final PagingParameters FIRST_PAGE = new PagingParameters(25, null, null, null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;

class FriendTemplate implements FriendOperations {
public class FriendTemplate implements FriendOperations {

private final GraphApi graphApi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.springframework.social.facebook.api.PagingParameters;
import org.springframework.util.MultiValueMap;

class GroupTemplate implements GroupOperations {
public class GroupTemplate implements GroupOperations {

private final GraphApi graphApi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.springframework.social.facebook.api.Reference;
import org.springframework.util.LinkedMultiValueMap;

class LikeTemplate implements LikeOperations {
public class LikeTemplate implements LikeOperations {

private final GraphApi graphApi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

class MediaTemplate implements MediaOperations {
public class MediaTemplate implements MediaOperations {

private final GraphApi graphApi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

class OpenGraphTemplate implements OpenGraphOperations {
public class OpenGraphTemplate implements OpenGraphOperations {

private GraphApi graphApi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

class PageTemplate implements PageOperations {
public class PageTemplate implements PageOperations {

private final GraphApi graphApi;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.springframework.social.facebook.api.impl;

/**
* Created by fbalicchia on 13/04/2018.
*/
public class ProfileData
{
public static final String[] PROFILE_FIELDS = {
"id", "about", "age_range", "birthday", "context", "cover", "currency", "devices", "education", "email",
"favorite_athletes", "favorite_teams", "first_name", "gender", "hometown", "inspirational_people", "installed", "install_type",
"is_verified", "languages", "last_name", "link", "locale", "location", "meeting_for", "middle_name", "name", "name_format",
"political", "quotes", "payment_pricepoints", "relationship_status", "religion", "security_settings", "significant_other",
"sports", "test_group", "timezone", "third_party_id", "updated_time", "verified", "video_upload_limits", "viewer_can_send_gift",
"website", "work"
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;

class SocialContextTemplate implements SocialContextOperations {
public class SocialContextTemplate implements SocialContextOperations {

private static final int LIMIT = 25;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@

import com.fasterxml.jackson.databind.JsonNode;

class UserTemplate implements UserOperations {
public class UserTemplate implements UserOperations {

private final GraphApi graphApi;

private final RestTemplate restTemplate;

public UserTemplate(GraphApi graphApi, RestTemplate restTemplate) {
Expand All @@ -50,7 +50,7 @@ public User getUserProfile() {
}

public User getUserProfile(String facebookId) {
return graphApi.fetchObject(facebookId, User.class, PROFILE_FIELDS);
return graphApi.fetchObject(facebookId, User.class, ProfileData.PROFILE_FIELDS);
}

public byte[] getUserProfileImage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import static org.junit.Assert.*;
import static org.springframework.http.HttpMethod.*;
import org.springframework.social.facebook.api.impl.ProfileData;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.*;
import static org.springframework.test.web.client.response.MockRestResponseCreators.*;

Expand All @@ -37,9 +38,9 @@ public class UserTemplateTest extends AbstractFacebookApiTest {
private static String PROFILE_FIELDS;

static {
StringBuilder builder = new StringBuilder(UserOperations.PROFILE_FIELDS[0]);
for (int i=1; i < UserOperations.PROFILE_FIELDS.length; i++) {
builder.append("%2C").append(UserOperations.PROFILE_FIELDS[i]);
StringBuilder builder = new StringBuilder(ProfileData.PROFILE_FIELDS[0]);
for (int i=1; i < ProfileData.PROFILE_FIELDS.length; i++) {
builder.append("%2C").append(ProfileData.PROFILE_FIELDS[i]);
}
PROFILE_FIELDS = builder.toString();
}
Expand Down