Class: Twitter::Client

Inherits:
Object
  • Object
show all
Includes:
API, Configurable
Defined in:
lib/twitter/client.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

Constant Summary

Constants included from API

API::DEFAULT_CURSOR, API::DEFAULT_TWEETS_PER_REQUEST, API::MAX_TWEETS_PER_REQUEST, API::MAX_USERS_PER_REQUEST

Instance Attribute Summary

Attributes included from Configurable

#connection_options, #consumer_key, #consumer_secret, #endpoint, #identity_map, #middleware, #oauth_token, #oauth_token_secret

Instance Method Summary collapse

Methods included from Configurable

#cache_key, #configure, #credentials?, keys, #reset!

Methods included from API

#activity_about_me, #activity_by_friends, #block, #block?, #blocked_ids, #blocking, #configuration, #contributees, #contributors, #direct_message, #direct_message_create, #direct_message_destroy, #direct_messages, #direct_messages_received, #direct_messages_sent, #favorite, #favorites, #follow, #follow!, #follower_ids, #following_followers_of, #friend_ids, #friendship, #friendship?, #friendship_update, #friendships, #friendships_incoming, #friendships_outgoing, #home_timeline, #languages, #list, #list_add_member, #list_add_members, #list_create, #list_destroy, #list_member?, #list_members, #list_remove_member, #list_remove_members, #list_subscribe, #list_subscriber?, #list_subscribers, #list_timeline, #list_unsubscribe, #list_update, #lists, #media_timeline, #memberships, #mentions_timeline, #oembed, #oembeds, #phoenix_search, #place, #place_create, #places_nearby, #places_similar, #privacy, #report_spam, #retweet, #retweeted_by_me, #retweeted_by_user, #retweeted_to_me, #retweeters_of, #retweets, #retweets_of_me, #reverse_geocode, #saved_search, #saved_search_create, #saved_search_destroy, #saved_searches, #search, #settings, #status, #status_activity, #status_destroy, #statuses, #statuses_activity, #subscriptions, #suggest_users, #suggestions, #tos, #trends, #trends_available, #trends_closest, #unblock, #unfavorite, #unfollow, #update, #update_delivery_device, #update_profile, #update_profile_background_image, #update_profile_colors, #update_profile_image, #update_with_media, #user, #user?, #user_search, #user_timeline, #users, #verify_credentials

Constructor Details

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

Initializes a new Client object

Parameters:

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


23
24
25
26
27
# File 'lib/twitter/client.rb', line 23

def initialize(options={})
  Twitter::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] || Twitter.instance_variable_get(:"@#{key}"))
  end
end

Instance Method Details

#delete(path, params = {}, options = {}) ⇒ Object

Perform an HTTP DELETE request



30
31
32
# File 'lib/twitter/client.rb', line 30

def delete(path, params={}, options={})
  request(:delete, path, params, options)
end

#get(path, params = {}, options = {}) ⇒ Object

Perform an HTTP GET request



35
36
37
# File 'lib/twitter/client.rb', line 35

def get(path, params={}, options={})
  request(:get, path, params, options)
end

#post(path, params = {}, options = {}) ⇒ Object

Perform an HTTP POST request



40
41
42
# File 'lib/twitter/client.rb', line 40

def post(path, params={}, options={})
  request(:post, path, params, options)
end

#put(path, params = {}, options = {}) ⇒ Object

Perform an HTTP UPDATE request



45
46
47
# File 'lib/twitter/client.rb', line 45

def put(path, params={}, options={})
  request(:put, path, params, options)
end