package com.appspot.finajjarane.framework.social.impl;
import java.util.List;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.social.twitter.api.Tweet;
import org.springframework.social.twitter.api.impl.TwitterTemplate;
import org.springframework.stereotype.Component;
import com.appspot.finajjarane.framework.generic.ApplicationConstants;
import com.appspot.finajjarane.framework.social.ITwitter;
@Component
@Scope(BeanDefinition.SCOPE_SINGLETON)
public class Twitter implements ITwitter {
private TwitterTemplate twitter;
public Twitter(){
twitter = new TwitterTemplate( ApplicationConstants.TWITTER_CONSUMER_KEY,
ApplicationConstants.TWITTER_CONSUMER_SECRET,
ApplicationConstants.TWITTER_ACCESS_TOKEN,
ApplicationConstants.TWITTER_ACCESS_TOKEN_SECRET);
}
@Override
public List<Tweet> getLatestTweets(){
return twitter.timelineOperations().getHomeTimeline();
}
}