Class: Twitter::User

Inherits:
BasicUser show all
Includes:
Creatable, Profile
Defined in:
lib/twitter/user.rb

Constant Summary

Constants included from Profile

Profile::PREDICATE_URI_METHOD_REGEX, Profile::PROFILE_IMAGE_SUFFIX_REGEX

Instance Attribute Summary collapse

Attributes inherited from BasicUser

#screen_name

Attributes inherited from Identity

#id

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods included from Profile

#profile_banner_uri, #profile_banner_uri?, #profile_banner_uri_https, #profile_image_uri, #profile_image_uri?, #profile_image_uri_https

Methods included from Creatable

#created?, #created_at

Methods inherited from Identity

#initialize

Methods inherited from Base

#[], attr_reader, define_attribute_method, define_predicate_method, define_uri_method, display_uri_attr_reader, #initialize, object_attr_reader, predicate_attr_reader, uri_attr_reader

Methods included from Utils

flat_pmap, pmap

Constructor Details

This class inherits a constructor from Twitter::Identity

Instance Attribute Details

#connectionsArray (readonly)

Returns:

  • (Array)


12
13
14
# File 'lib/twitter/user.rb', line 12

def connections
  @connections
end

#descriptionString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/twitter/user.rb', line 17

def description
  @description
end

#emailString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/twitter/user.rb', line 17

def email
  @email
end

#favourites_countInteger (readonly) Also known as: favorites_count

Returns:

  • (Integer)


14
15
16
# File 'lib/twitter/user.rb', line 14

def favourites_count
  @favourites_count
end

#followers_countInteger (readonly)

Returns:

  • (Integer)


14
15
16
# File 'lib/twitter/user.rb', line 14

def followers_count
  @followers_count
end

#friends_countInteger (readonly)

Returns:

  • (Integer)


14
15
16
# File 'lib/twitter/user.rb', line 14

def friends_count
  @friends_count
end

#langString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/twitter/user.rb', line 17

def lang
  @lang
end

#listed_countInteger (readonly)

Returns:

  • (Integer)


14
15
16
# File 'lib/twitter/user.rb', line 14

def listed_count
  @listed_count
end

#locationString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/twitter/user.rb', line 17

def location
  @location
end

#nameString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/twitter/user.rb', line 17

def name
  @name
end

#profile_background_colorString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/twitter/user.rb', line 17

def profile_background_color
  @profile_background_color
end

Returns:

  • (String)


17
18
19
# File 'lib/twitter/user.rb', line 17

def profile_link_color
  @profile_link_color
end

#profile_sidebar_border_colorString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/twitter/user.rb', line 17

def profile_sidebar_border_color
  @profile_sidebar_border_color
end

#profile_sidebar_fill_colorString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/twitter/user.rb', line 17

def profile_sidebar_fill_color
  @profile_sidebar_fill_color
end

#profile_text_colorString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/twitter/user.rb', line 17

def profile_text_color
  @profile_text_color
end

#statuses_countInteger (readonly) Also known as: tweets_count

Returns:

  • (Integer)


14
15
16
# File 'lib/twitter/user.rb', line 14

def statuses_count
  @statuses_count
end

#time_zoneString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/twitter/user.rb', line 17

def time_zone
  @time_zone
end

#utc_offsetInteger (readonly)

Returns:

  • (Integer)


14
15
16
# File 'lib/twitter/user.rb', line 14

def utc_offset
  @utc_offset
end

Instance Method Details

#entities?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/twitter/user.rb', line 75

def entities?
  !@attrs[:entities].nil? && @attrs[:entities].any? { |_, hash| hash[:urls].any? }
end

#uriAddressable::URI Also known as: url

Returns The URL to the user.

Returns:

  • (Addressable::URI)

    The URL to the user.



81
82
83
# File 'lib/twitter/user.rb', line 81

def uri
  Addressable::URI.parse("https://twitter.com/#{screen_name}") if screen_name?
end

#websiteAddressable::URI

Returns The URL to the user's website.

Returns:

  • (Addressable::URI)

    The URL to the user's website.



88
89
90
91
92
93
94
# File 'lib/twitter/user.rb', line 88

def website
  if website_uris?
    website_uris.first.expanded_url
  else
    Addressable::URI.parse(@attrs[:url])
  end
end

#website?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/twitter/user.rb', line 97

def website?
  !!(website_uris? || @attrs[:url])
end