class Twitter::User
Attributes
connections[R]
@return [Array]
description[R]
@return [String]
email[R]
@return [String]
favorites_count[R]
@return [Integer]
favourites_count[R]
@return [Integer]
followers_count[R]
@return [Integer]
friends_count[R]
@return [Integer]
lang[R]
@return [String]
listed_count[R]
@return [Integer]
location[R]
@return [String]
name[R]
@return [String]
profile_background_color[R]
@return [String]
profile_link_color[R]
@return [String]
profile_text_color[R]
@return [String]
statuses_count[R]
@return [Integer]
time_zone[R]
@return [String]
tweets_count[R]
@return [Integer]
utc_offset[R]
@return [Integer]
Private Class Methods
define_entity_uris_method(key1, key2)
click to toggle source
# File lib/twitter/user.rb, line 54 def define_entity_uris_method(key1, key2) define_method(key1) do @attrs.fetch(:entities, {}).fetch(key2, {}).fetch(:urls, []).collect do |url| Entity::URI.new(url) end end memoize(key1) end
define_entity_uris_methods(key1, key2)
click to toggle source
Dynamically define a method for entity URIs
@param key1 [Symbol] @param key2 [Symbol]
# File lib/twitter/user.rb, line 43 def define_entity_uris_methods(key1, key2) array = key1.to_s.split('_') index = array.index('uris') array[index] = 'urls' url_key = array.join('_').to_sym define_entity_uris_method(key1, key2) alias_method(url_key, key1) define_entity_uris_predicate_method(key1) alias_method(:"#{url_key}?", :"#{key1}?") end
define_entity_uris_predicate_method(key1)
click to toggle source
# File lib/twitter/user.rb, line 63 def define_entity_uris_predicate_method(key1) define_method(:"#{key1}?") do send(:"#{key1}").any? end memoize(:"#{key1}?") end
Public Instance Methods
entities?()
click to toggle source
@return [Boolean]
# File lib/twitter/user.rb, line 75 def entities? !@attrs[:entities].nil? && @attrs[:entities].any? { |_, hash| hash[:urls].any? } end
uri()
click to toggle source
@return [Addressable::URI] The URL to the user.
# File lib/twitter/user.rb, line 81 def uri Addressable::URI.parse("https://twitter.com/#{screen_name}") if screen_name? end
Also aliased as: url
website()
click to toggle source
@return [Addressable::URI] The URL to the user's website.
# 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?()
click to toggle source
# File lib/twitter/user.rb, line 97 def website? !!(website_uris? || @attrs[:url]) end