Example usage for twitter4j AccountSettings getTimeZone

List of usage examples for twitter4j AccountSettings getTimeZone

Introduction

In this page you can find the example usage for twitter4j AccountSettings getTimeZone.

Prototype

TimeZone getTimeZone();

Source Link

Document

Returns the timezone configured for this user.

Usage

From source file:uk.ac.susx.tag.method51.webapp.handler.TwitterPinAuthHandler.java

License:Apache License

private void getUserInfo(String target, Request baseRequest, HttpServletRequest request,
        HttpServletResponse response) throws IOException {
    final Params params = new Params();
    params.addValidator("id", new SystemStringValidator(true));

    new DoSomethingAfterValidatingMyParams(params, request, response) {
        @Override/*w  w  w .ja  va2 s.  c o  m*/
        public void something() throws IOException {
            final String id = request.getParameter("id");
            final Twitter twitter = newTwitterInstance(ApiKeyStore.getKey(id));

            try {
                final AccountSettings as = twitter.getAccountSettings();
                final String userScreenName = twitter.getScreenName();
                final long userId = twitter.getId();
                final User user = twitter.showUser(userId);

                okHereIsYourJson(response, "name", user.getName(), "description", user.getDescription(),
                        "created", user.getCreatedAt(), "favourites_count", user.getFavouritesCount(),
                        "followers_count", user.getFollowersCount(), "friends_count", user.getFriendsCount(),
                        "profile_image_url", user.getProfileImageURL(), "screen_name", userScreenName,
                        "user_id", userId, "language", as.getLanguage(), "sleep_time_enabled",
                        as.isSleepTimeEnabled(), "sleep_end_time", as.getSleepEndTime(), "sleep_start_time",
                        as.getSleepStartTime(), "timezone", as.getTimeZone(), "trend_locations",
                        as.getTrendLocations(), "always_use_https", as.isAlwaysUseHttps(),
                        "discoverable_by_email", as.isDiscoverableByEmail(), "geo_enabled", as.isGeoEnabled());
            } catch (TwitterException e) {
                LOG.warn("Failed to retrieve users data.", e);
                error(e.getMessage());
            }
        }
    };
}