Guest User

Untitled

a guest
Feb 21st, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. Shoes.setup do
  2. gem 'twitter'
  3. end
  4.  
  5. require 'twitter'
  6.  
  7. class TwitShoes < Shoes
  8. url '/', :index
  9.  
  10. def index
  11. background "#202020"
  12. user = login
  13. t = timeline
  14.  
  15. t[0].zip(t[1]).each { |img, status|
  16. flow {
  17. background gradient('#000', '#FFF')
  18. stack :width => "18%" do
  19. image "#{img}"
  20. end
  21. stack :width => "82%" do
  22. para "#{status}", :size => 9, :font => "Arial", :stroke => '#FF0066'
  23. end
  24. }
  25. }
  26. end
  27.  
  28. def login
  29. @username = ask "Please, enter your username:"
  30. @password = ask "Please, enter your password:", :secret => true
  31. user = Twitter::Base.new(@username, @password).user(@username)
  32. @name = user.name
  33. end
  34.  
  35. def timeline
  36. @img, @status = [], []
  37. Twitter::Base.new(@username, @password).timeline.each do |s|
  38. @img << s.user.profile_image_url
  39. @status << s.text
  40. end
  41. [@img, @status]
  42. end
  43.  
  44. end
  45. Shoes.app :width => 260, :height => 400, :resizable => false, :title => "TwitShoes"
Add Comment
Please, Sign In to add comment