Package com.restfb.types

Examples of com.restfb.types.User


  public Content getContent(String contentURL) {
    String fbid = URLUtils.getFbId(contentURL);
    logger.debug(fbid);
    // get user information
    // User user = fbClient.getFacebookUserProfile(fbid);
    User user = getFbClient().getFacebookObjectByID(fbid, User.class);
    // user to content
    Content content = user2Content(user);
    content.setContentUrl(contentURL);

    return content;
View Full Code Here


    assertTrue(contentList.size()==0);
               
    //expected behavior   
    expect(mockFactory.createFacebookAPIClient(EasyMock.anyObject(String.class))).andReturn(mockFbClient).anyTimes();           
   
    User user = loadObjectFromJSON("/examples/me.json",User.class);
    expect(mockFbClient.getFacebookObjectByID("me", User.class)).andReturn(user)
   
    List<User> friends = loadListFromJSON("/examples/me_friends.json", User.class);
   
    expect(mockFbClient.getFacebookConnectionByID("me/friends", User.class)).andReturn(friends);
View Full Code Here

  }

  public void testGetFacebookObjectByID() {

    // declare behavior
    User user = new User();
    expect(mockFb.fetchObject("fbid", User.class)).andReturn(user);

    // register behavior
    replay(mockFb);

    // readFBClient.fetchObject(id, objectClass);
    User actualUser = fbRestClient
        .getFacebookObjectByID("fbid", User.class);

    // verify behavior
    verify();
View Full Code Here

  }

  public void testGetContent() throws IOException {
    String contentUrl = "facebook/accessTokenKey/fbid/status";

    User expectedUser = loadObjectFromJSON("/examples/me.json", User.class);

    // expected behavior
    // expect(mockFactory.createFacebookAPIClient(EasyMock.anyObject(String.class))).andReturn(mockFbClient);
    expect(mockFbClient.getFacebookObjectByID("fbid", User.class))
        .andReturn(expectedUser);
View Full Code Here

      if (p.getMessage() != null
          && (sinceTime == null || sinceTime != null
              && Long.valueOf(
                  p.getCreatedTime().getTime() / 1000L)
                  .compareTo(sinceTime) >= 0)) {
        User sender = facebookClient.fetchObject(p.getFrom().getId(),
            User.class);
        String screenName = sender.getUsername().isEmpty() ? sender
            .getId() : sender.getUsername();
        FacebookMention fbp = new FacebookMention(p.getId(), p.getMessage(),
            screenName, p.getCreatedTime().getTime());
        recentPosts.add(fbp);
      }
    }
View Full Code Here

          Comment.class, Parameter.with("limit", "25"),
          Parameter.with("since", sinceTime));
    }
    LOG.info("Retrieved [" + comments.getData().size() + "] comments");
    for (Comment c : comments.getData()) {
      User sender = facebookClient.fetchObject(c.getFrom().getId(),
          User.class);
      String screenName = sender.getUsername().isEmpty() ? sender.getId()
          : sender.getUsername();
      FacebookMention fbp = new FacebookMention(c.getId(), c.getMessage(),
          screenName, c.getCreatedTime().getTime(), postId);
      messageReplies.add(fbp);
    }
    LOG.info("End getPostComments");
View Full Code Here

  public String publish(String to, String message) {
    LOG.info("Start publish");
    FacebookType publishMessageResponse = null;
//    try {
    if (to != null) {
      User user = facebookClient.fetchObject(to, User.class);
      publishMessageResponse = facebookClient.publish(user.getId()
          + "/feed", FacebookType.class,
          Parameter.with("message", message));
    } else {
      publishMessageResponse = facebookClient.publish("me/feed",
          FacebookType.class, Parameter.with("message", message));
View Full Code Here

TOP

Related Classes of com.restfb.types.User

Copyright © 2018 www.massapicom. 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.