Class: Twitter::Client

Inherits:
Object
  • Object
show all
Includes:
Authenticatable, Accounts, Activity, Block, DirectMessages, Favorites, FriendsAndFollowers, Help, Legal, Lists, LocalTrends, Notification, PlacesAndGeo, SavedSearches, Search, SpamReporting, SuggestedUsers, Timelines, Trends, Tweets, Urls, Users, Connection, Request
Defined in:
lib/twitter/client.rb,
lib/twitter/client/help.rb,
lib/twitter/client/urls.rb,
lib/twitter/client/block.rb,
lib/twitter/client/legal.rb,
lib/twitter/client/lists.rb,
lib/twitter/client/users.rb,
lib/twitter/client/search.rb,
lib/twitter/client/trends.rb,
lib/twitter/client/tweets.rb,
lib/twitter/client/accounts.rb,
lib/twitter/client/activity.rb,
lib/twitter/client/favorites.rb,
lib/twitter/client/timelines.rb,
lib/twitter/client/local_trends.rb,
lib/twitter/client/notification.rb,
lib/twitter/client/places_and_geo.rb,
lib/twitter/client/saved_searches.rb,
lib/twitter/client/spam_reporting.rb,
lib/twitter/client/direct_messages.rb,
lib/twitter/client/suggested_users.rb,
lib/twitter/client/friends_and_followers.rb

Overview

Note:

All methods have been separated into modules and follow the same grouping used in the Twitter API Documentation.

Wrapper for the Twitter REST API

Defined Under Namespace

Modules: Accounts, Activity, Block, DirectMessages, Favorites, FriendsAndFollowers, Help, Legal, Lists, LocalTrends, Notification, PlacesAndGeo, SavedSearches, Search, SpamReporting, SuggestedUsers, Timelines, Trends, Tweets, Urls, Users

Instance Method Summary collapse

Methods included from Users

#contributees, #contributors, #profile_image, #recommendations, #user, #user?, #user_search, #users

Methods included from Urls

#resolve

Methods included from Tweets

#oembed, #retweet, #retweeters_of, #retweets, #status, #status_destroy, #update, #update_with_media

Methods included from Trends

#trends_daily, #trends_weekly

Methods included from Timelines

#home_timeline, #media_timeline, #mentions, #network_timeline, #public_timeline, #retweeted_by, #retweeted_to, #retweets_of_me, #user_timeline

Methods included from SuggestedUsers

#suggest_users, #suggestions

Methods included from SpamReporting

#report_spam

Methods included from Search

#images, #phoenix_search, #search, #videos

Methods included from SavedSearches

#saved_search, #saved_search_create, #saved_search_destroy, #saved_searches

Methods included from PlacesAndGeo

#place, #place_create, #places_nearby, #places_similar, #reverse_geocode

Methods included from Notification

#disable_notifications, #enable_notifications

Methods included from LocalTrends

#local_trends, #trend_locations

Methods included from Lists

#list, #list_add_member, #list_add_members, #list_create, #list_destroy, #list_member?, #list_members, #list_remove_member, #list_subscribe, #list_subscriber?, #list_subscribers, #list_timeline, #list_unsubscribe, #list_update, #lists, #lists_subscribed_to, #memberships, #subscriptions

Methods included from Legal

#privacy, #tos

Methods included from Help

#configuration, #languages

Methods included from FriendsAndFollowers

#accept, #deny, #follow, #follower_ids, #friend_ids, #friendship, #friendship?, #friendship_update, #friendships, #friendships_incoming, #friendships_outgoing, #no_retweet_ids, #unfollow

Methods included from Favorites

#favorite, #favorites, #unfavorite

Methods included from DirectMessages

#direct_message, #direct_message_create, #direct_message_destroy, #direct_messages, #direct_messages_sent

Methods included from Block

#block, #block?, #blocked_ids, #blocking, #unblock

Methods included from Activity

#activity_about_me, #activity_by_friends

Methods included from Accounts

#end_session, #rate_limit_status, #settings, #update_delivery_device, #update_profile, #update_profile_background_image, #update_profile_colors, #update_profile_image, #verify_credentials

Methods included from Request

#delete, #get, #post

Methods included from Authenticatable

#credentials, #credentials?

Constructor Details

#initialize(attrs = {}) ⇒ Twitter::Client

Initializes a new API object

Parameters:

  • attrs (Hash) (defaults to: {})


111
112
113
114
115
116
# File 'lib/twitter/client.rb', line 111

def initialize(attrs={})
  attrs = Twitter.options.merge(attrs)
  Config::VALID_OPTIONS_KEYS.each do |key|
    instance_variable_set("@#{key}".to_sym, attrs[key])
  end
end

Instance Method Details

#current_userTwitter::User

Returns the configured screen name or the screen name of the authenticated user

Returns:



121
122
123
# File 'lib/twitter/client.rb', line 121

def current_user
  @current_user ||= Twitter::User.new(self.verify_credentials)
end