Guest User

Untitled

a guest
Jul 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. httpauth = Twitter::HTTPAuth.new( current_account.twitter_username, current_account.twitter_password )
  2. client = Twitter::Base.new(httpauth)
  3. # TO DO -- Yep, should filter the request to only get tweets since the last check
  4. client.friends_timeline.each do |tweet|
  5. # TO DO -- Yep, need to check to see if the tweet is already in there
  6. status = Status.create(
  7. :status_created_at => tweet.status_created_at,
  8. :status_id => tweet.id,
  9. :message => tweet.text,
  10. :source => tweet.source,
  11. :truncated => tweet.truncated,
  12. :in_reply_to_status_id => tweet.in_reply_to_status_id,
  13. :in_reply_to_user_id => tweet.in_reply_to_user_id,
  14. :favorited => tweet.favorited,
  15. :in_reply_to_screen_name => tweet.in_reply_to_screen_name
  16. )
  17. twitter_user = TwitterUser.find_or_create_user( tweet.user )
  18. twitter_user.statuses << status
Add Comment
Please, Sign In to add comment