Examples of fetchObject()


Examples of com.restfb.DefaultFacebookClient.fetchObject()

public class FacebookHelper {

  public static String getUsername(String accessToken) {
   
    FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
    User user = facebookClient.fetchObject("me", User.class);
    if (user != null) {
      return user.getName();
    }
    return null;
  }
View Full Code Here

Examples of com.restfb.DefaultFacebookClient.fetchObject()

  }
 
  public static String getUserId(String accessToken) {
   
    FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
    User user = facebookClient.fetchObject("me", User.class);
    if (user != null) {
      return user.getId();
    }
    return null;
  }
View Full Code Here

Examples of com.restfb.DefaultFacebookClient.fetchObject()

  }
 
  public static String getEmail(String accessToken) {
   
    FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
    User user = facebookClient.fetchObject("me", User.class);
    if (user != null) {
      return user.getEmail();
    }
    return null;
  }
View Full Code Here

Examples of com.restfb.DefaultFacebookClient.fetchObject()

  }
 
  public static User getUser(String accessToken) {
   
    FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
    User user = facebookClient.fetchObject("me", User.class);
    if (user != null) {
      return user;
    }
    return null;
  }
View Full Code Here

Examples of com.restfb.DefaultFacebookClient.fetchObject()

    public Response facebookLogin(@QueryParam("access_token") String access_token) {
        String appId = env.get("facebook.appId");
        String appSecret = env.get("facebook.appSecret");
        try {
            FacebookClient facebookClient = new DefaultFacebookClient(access_token);
            User user = facebookClient.fetchObject("me", User.class);

            String me = "";
            try {
                me = gson.toJson(user);
            } catch (Exception e) {
View Full Code Here

Examples of com.restfb.DefaultFacebookClient.fetchObject()

   
    @Test
    public void version1Test() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper(), Version.VERSION_1_0);
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/v1.0/me?access_token=12345&format=json", respstring);
    }
   
    @Test
    public void version2Test() {
View Full Code Here

Examples of com.restfb.DefaultFacebookClient.fetchObject()

   
    @Test
    public void version2Test() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper(), Version.VERSION_2_0);
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/v2.0/me?access_token=12345&format=json", respstring);
    }
   
    @Test
    public void version21Test() {
View Full Code Here

Examples of com.restfb.DefaultFacebookClient.fetchObject()

   
    @Test
    public void version21Test() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper(), Version.VERSION_2_1);
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/v2.1/me?access_token=12345&format=json", respstring);
    }
   
    @Test
    public void unversionedTest() {
View Full Code Here

Examples of com.restfb.DefaultFacebookClient.fetchObject()

   
    @Test
    public void unversionedTest() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper(), Version.UNVERSIONED);
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/me?access_token=12345&format=json", respstring);
    }
   
    @Test
    public void unversionedNoVersionTest() {
View Full Code Here

Examples of com.restfb.DefaultFacebookClient.fetchObject()

   
    @Test
    public void unversionedNoVersionTest() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper());
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/me?access_token=12345&format=json", respstring);
    }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.