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)


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

def connections
  @connections
end

#descriptionString (readonly)


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

def description
  @description
end

#emailString (readonly)


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

def email
  @email
end

#favourites_countInteger (readonly) Also known as: favorites_count


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

def favourites_count
  @favourites_count
end

#followers_countInteger (readonly)


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

def followers_count
  @followers_count
end

#friends_countInteger (readonly)


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

def friends_count
  @friends_count
end

#langString (readonly)


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

def lang
  @lang
end

#listed_countInteger (readonly)


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

def listed_count
  @listed_count
end

#locationString (readonly)


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

def location
  @location
end

#nameString (readonly)


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

def name
  @name
end

#profile_background_colorString (readonly)


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

def profile_background_color
  @profile_background_color
end

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

def profile_link_color
  @profile_link_color
end

#profile_sidebar_border_colorString (readonly)


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)


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

def profile_sidebar_fill_color
  @profile_sidebar_fill_color
end

#profile_text_colorString (readonly)


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


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

def statuses_count
  @statuses_count
end

#time_zoneString (readonly)


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

def time_zone
  @time_zone
end

#utc_offsetInteger (readonly)


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

def utc_offset
  @utc_offset
end

Instance Method Details

#entities?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


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


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


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

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