Advertisement
Guest User

Untitled

a guest
Oct 17th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. class User
  2. def initialize(firstname, lastname, username, password, photo_url, friends)
  3. @firstname = firstname
  4. @lastname = lastname
  5. @username = username
  6. @password = password
  7. @photo_url = photo_url
  8. @is_logged_in = False
  9. @friends = []
  10. end
  11.  
  12.  
  13. def signup(firstname, lastname, username, password, photo_url)
  14. @firstname = firstname
  15. @lastname = lastname
  16. @username = username
  17. @password = password
  18. @photo_url = photo_url
  19. end
  20.  
  21.  
  22. def login(username, password)
  23. if @username = username && @password = password
  24. @is_logged_in = True
  25. else
  26. return "Invalid Login Details"
  27. end
  28.  
  29.  
  30. def user_friends(username)
  31. @friends.push(username)
  32. end
  33.  
  34.  
  35.  
  36. class Post
  37. def initialize(posted_by, post_time, post_content, shared_by, liked_by, post_title)
  38. @posted_by = posted_by
  39. @post_time = post_time
  40. @post_content = post_time
  41. @shared_by = []
  42. @liked_by = []
  43. @post_title = post_title
  44. end
  45.  
  46. def share(username):
  47. @shared_by.append(@username)
  48.  
  49. def like(self, user):
  50. @liked_by.append(@username)
  51.  
  52. def make_a_post(post_title, post_content)
  53. @post_title = post_title
  54. @post_content = post_content
  55. end
  56.  
  57. class Chat
  58. def initialize(sender, receiver, content, seen_time)
  59. @sender = sender
  60. @receiver = receiver
  61. @content = content
  62. @seen_time = seen_time
  63.  
  64. def send(content, receiver, sender)
  65. @content = content
  66. @receiver = receiver
  67. @sender = sender
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement