Class: Twterm::User

Inherits:
Object
  • Object
show all
Defined in:
lib/twterm/user.rb

Overview

A Twitter user

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ User

Returns a new instance of User.



10
11
12
13
# File 'lib/twterm/user.rb', line 10

def initialize(user)
  @id = user.id
  update!(user)
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/twterm/user.rb', line 4

def description
  @description
end

#favorites_countObject (readonly)

Returns the value of attribute favorites_count.



4
5
6
# File 'lib/twterm/user.rb', line 4

def favorites_count
  @favorites_count
end

#followers_countObject (readonly)

Returns the value of attribute followers_count.



4
5
6
# File 'lib/twterm/user.rb', line 4

def followers_count
  @followers_count
end

#friends_countObject (readonly)

Returns the value of attribute friends_count.



4
5
6
# File 'lib/twterm/user.rb', line 4

def friends_count
  @friends_count
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/twterm/user.rb', line 4

def id
  @id
end

#locationObject (readonly)

Returns the value of attribute location.



4
5
6
# File 'lib/twterm/user.rb', line 4

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/twterm/user.rb', line 4

def name
  @name
end

#profile_background_imageObject (readonly)

Returns the value of attribute profile_background_image.



4
5
6
# File 'lib/twterm/user.rb', line 4

def profile_background_image
  @profile_background_image
end

#profile_imageObject (readonly)

Returns the value of attribute profile_image.



4
5
6
# File 'lib/twterm/user.rb', line 4

def profile_image
  @profile_image
end

#protectedObject (readonly) Also known as: protected?

Returns the value of attribute protected.



4
5
6
# File 'lib/twterm/user.rb', line 4

def protected
  @protected
end

#screen_nameObject (readonly)

Returns the value of attribute screen_name.



4
5
6
# File 'lib/twterm/user.rb', line 4

def screen_name
  @screen_name
end

#statuses_countObject (readonly)

Returns the value of attribute statuses_count.



4
5
6
# File 'lib/twterm/user.rb', line 4

def statuses_count
  @statuses_count
end

#urlObject (readonly)

Returns the value of attribute url.



4
5
6
# File 'lib/twterm/user.rb', line 4

def url
  @url
end

#verifiedObject (readonly) Also known as: verified?

Returns the value of attribute verified.



4
5
6
# File 'lib/twterm/user.rb', line 4

def verified
  @verified
end

#websiteObject (readonly)

Returns the value of attribute website.



4
5
6
# File 'lib/twterm/user.rb', line 4

def website
  @website
end

Instance Method Details

#update!(user) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/twterm/user.rb', line 15

def update!(user)
  @name = user.name
  @screen_name = user.screen_name
  @description = user.description.is_a?(Twitter::NullObject) ? '' : user.description
  @location = user.location.is_a?(Twitter::NullObject) ? '' : user.location
  @website = user.website
  @protected = user.protected?
  @statuses_count = user.statuses_count
  @favorites_count = user.favorites_count
  @friends_count = user.friends_count
  @followers_count = user.followers_count
  @url = user.url
  @verified = user.verified?
  @profile_image = user.profile_image_uri_https
  @profile_background_image = user.profile_banner_uri_https

  self
end