class Twitter::Client
Used to query or post to the Twitter REST API to simplify code.
Attributes
Public Class Methods
returns configuration object
# File lib/twitter/config.rb, line 102 def config @@config end
Yields to given block
to configure the Twitter4R API.
# File lib/twitter/config.rb, line 107 def configure(&block) raise ArgumentError, "Block must be provided to configure" unless block_given? yield config end
Helper method mostly for irb shell prototyping.
Reads in login/password Twitter credentials
from YAML file found at the location given by config_file
that
has the following format:
envname: login: mytwitterlogin password: mytwitterpassword
Where envname
is the name of the environment like
'test', 'dev' or 'prod'. The env
argument defaults to 'test'.
To use this in the shell you would do something like the following examples:
twitter = Twitter::Client.from_config('config/twitter.yml', 'dev') twitter = Twitter::Client.from_config('config/twitter.yml')
# File lib/twitter/console.rb, line 24 def from_config(config_file, env = 'test') yaml_hash = YAML.load(File.read(config_file)) self.new yaml_hash[env] end
Public Instance Methods
Provides access to the Twitter rate limit status API.
You can find out information about your account status. Currently the only
supported type of account status is the :rate_limit_status
which returns a Twitter::RateLimitStatus
object.
Example:
account_status = client.account_info puts account_status.remaining_hits
# File lib/twitter/client/account.rb, line 15 def account_info(type = :rate_limit_status) response = rest_oauth_connect(:get, @@ACCOUNT_URIS[type]) bless_models(Twitter::RateLimitStatus.unmarshal(response.body)) end
Provides access to the Twitter verify credentials API.
You can verify Twitter user credentials with minimal overhead using this method.
Example:
client.authenticate?("osxisforlightweights", "l30p@rd_s^cks!")
# File lib/twitter/client/auth.rb, line 12 def authenticate?(login, password) verify_credentials(login, password) end
Provides access to the Twitter Block API.
You can add and remove blocks to users using this method.
action
can be any of the following values:
-
:add
- to add a block, you would use thisaction
value -
:remove
- to remove a block use this.
The value
must be either the user screen name, integer unique
user ID or Twitter::User object representation.
Examples:
screen_name = 'dictionary' client.block(:add, 'dictionary') client.block(:remove, 'dictionary') id = 1260061 client.block(:add, id) client.block(:remove, id) user = Twitter::User.find(id, client) client.block(:add, user) client.block(:remove, user)
# File lib/twitter/client/blocks.rb, line 28 def block(action, value) raise ArgumentError, "Invalid friend action provided: #{action}" unless @@BLOCK_URIS.keys.member?(action) value = value.to_i unless value.is_a?(String) uri = "#{@@BLOCK_URIS[action]}/#{value}.json" response = rest_oauth_connect(:get, uri) bless_model(Twitter::User.unmarshal(response.body)) end
Provides access to the Twitter add/remove favorite API.
You can add and remove favorite status using this method.
action
can be any of the following values:
-
:add
- to add a status to your favorites, you would use thisaction
value -
:remove
- to remove an status from your existing favorites list use this.
The value
must be either the status object to add or remove or
the integer unique status ID.
Examples:
id = 126006103423 client.favorite(:add, id) client.favorite(:remove, id) status = Twitter::Status.find(id, client) client.favorite(:add, status) client.favorite(:remove, status)
# File lib/twitter/client/favorites.rb, line 40 def favorite(action, value) raise ArgumentError, "Invalid favorite action provided: #{action}" unless @@FAVORITES_URIS.keys.member?(action) value = value.to_i.to_s unless value.is_a?(String) uri = "#{@@FAVORITES_URIS[action]}/#{value}.json" case action when :add response = rest_oauth_connect(:post, uri) when :remove response = rest_oauth_connect(:delete, uri) end bless_model(Twitter::Status.unmarshal(response.body)) end
Provides access to the Twitter list favorites API.
You can access the authenticated [Twitter] user's favorites list using this method.
By default you will receive the last twenty statuses added to your favorites list. To get a previous page you can provide options to this method. For example,
statuses = client.favorites(:page => 2)
The above one-liner will get the second page of favorites for the authenticated user.
# File lib/twitter/client/favorites.rb, line 16 def favorites(options = nil) uri = '/favorites.json' response = rest_oauth_connect(:get, uri, options) bless_models(Twitter::Status.unmarshal(response.body)) end
Provides access to the Featured Twitter API.
Currently the only value for type
accepted is
:users
, which will return an Array of blessed Twitter::User objects that represent Twitter's
featured users.
# File lib/twitter/extras.rb, line 19 def featured(type) uri = @@FEATURED_URIS[type] response = rest_oauth_connect(:get, uri) bless_models(Twitter::User.unmarshal(response.body)) end
Provides access to the Twitter Friendship API.
You can add and remove friends using this method.
action
can be any of the following values:
-
:add
- to add a friend, you would use thisaction
value -
:remove
- to remove an existing friend from your friends list use this.
The value
must be either the user to befriend or
defriend's screen name, integer unique user ID or Twitter::User object representation.
Examples:
screen_name = 'dictionary' client.friend(:add, 'dictionary') client.friend(:remove, 'dictionary') id = 1260061 client.friend(:add, id) client.friend(:remove, id) user = Twitter::User.find(id, client) client.friend(:add, user) client.friend(:remove, user)
# File lib/twitter/client/friendship.rb, line 33 def friend(action, value) raise ArgumentError, "Invalid friend action provided: #{action}" unless @@FRIEND_URIS.keys.member?(action) value = value.to_i unless value.is_a?(String) uri = "#{@@FRIEND_URIS[action]}/#{value}.json" response = rest_oauth_connect(:post, uri) bless_model(Twitter::User.unmarshal(response.body)) end
Provides friendship information for the following scenarios:
-
:incoming
- returns an array of numeric IDs for every user who has a pending request to follow the authenticating user. -
:outgoing
- returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request.
Examples:
client.friendships(:incoming) #=> { :id_list => { :ids => [30592818, 21249843], :next_cursor => 1288724293877798413, :previous_cursor => -1300794057949944903 }}
# File lib/twitter/client/friendship.rb, line 48 def friendships(action) raise ArgumentError, "Invalid friend action provided: #{action}" unless @@FRIENDSHIP_URIS.keys.member?(action) uri = @@FRIENDSHIP_URIS[action] response = rest_oauth_connect(:get, uri) JSON.parse(response.body) end
Provides access to the Twitter Social Graphing API.
You can retrieve the full graph of a user's friends or followers in one method call.
action
can be any of the following values:
-
:friends
- retrieves ids of all friends of a given user. -
:followers
- retrieves ids of all followers of a given user.
The value
must be either the user screen name, integer unique
user ID or Twitter::User object representation.
Examples:
screen_name = 'dictionary' client.graph(:friends, 'dictionary') client.graph(:followers, 'dictionary') id = 1260061 client.graph(:friends, id) client.graph(:followers, id) user = Twitter::User.find(id, client) client.graph(:friends, user) client.graph(:followers, user)
# File lib/twitter/client/graph.rb, line 28 def graph(action, value = nil) raise ArgumentError, "Invalid friend action provided: #{action}" unless @@GRAPH_URIS.keys.member?(action) id = value.to_i unless value.nil? || value.is_a?(String) id ||= value id ||= @login uri = "#{@@GRAPH_URIS[action]}.json" response = rest_oauth_connect(:get, uri, :id => id) JSON.parse(response.body) end
# File lib/twitter/client/base.rb, line 4 def inspect s = old_inspect s.gsub!(/@password=".*?"/, '@password="XXXX"') s.gsub!(/"secret"=>".*?"/, '"secret"=>"XXXX"') s end
Provides access to Twitter's Messaging API for sending and deleting direct messages to other users.
action
can be:
-
:post
- to send a new direct message,value
, touser
given. -
:delete
- to delete direct message with message IDvalue
.
value
should be:
-
String
when action is:post
. Will be the message text sent to givenuser
. -
Integer
orTwitter::Message
object when action is:delete
. Will refer to the unique message ID to delete. When passing in an instance ofTwitter::Message
that Status will be
user
should be:
-
Twitter::User
,Integer
orString
object whenaction
is:post
. TheInteger
must be the unique ID of the Twitter user you wish to send the direct message to and anyString
s passed in must be the screen name of the user you wish to send the direct message to. -
totally ignore when
action
is:delete
. It has no purpose in this use case scenario.
Examples: The example below sends the message text 'Are you coming over at 6pm for the BBQ tonight?' to user with screen name 'myfriendslogin'…
@twitter.message(:post, 'Are you coming over at 6pm for the BBQ tonight?', 'myfriendslogin')
The example below sends the same message text as above to user with unique
integer ID of 1234567890… the example below sends the same message text as
above to user represented by user
object instance of
Twitter::User
…
@twitter.message(:post, 'Are you coming over at 6pm for the BBQ tonight?', user) message = @twitter.message(:post, 'Are you coming over at 6pm for the BBQ tonight?', 1234567890)
the example below delete's the message send directly above to user with unique ID 1234567890…
@twitter.message(:delete, message)
Or the following can also be done…
@twitter.message(:delete, message.id)
In both scenarios (action
is :post
or
:delete
) a blessed Twitter::Message
object is
returned that represents the newly posted or newly deleted message.
An ArgumentError
will be raised if an invalid
action
is given. Valid actions are:
-
:post
-
:delete
An ArgumentError
is also raised when no user argument is
supplied when action
is :post
.
# File lib/twitter/client/messaging.rb, line 64 def message(action, value, user = nil) raise ArgumentError, "Invalid messaging action: #{action}" unless [:post, :delete].member?(action) raise ArgumentError, "User argument must be supplied for :post case" if action.eql?(:post) and user.nil? uri = @@MESSAGING_URIS[action] user = user.to_i if user and user.is_a?(Twitter::User) case action when :post response = rest_oauth_connect(:post, uri, {:text => value, :user => user, :source => self.class.config.source}) when :delete response = rest_oauth_connect(:delete, uri, :id => value.to_i) end message = Twitter::Message.unmarshal(response.body) bless_model(message) end
Provides access to Twitter's Messaging API for received and sent direct messages.
Example:
received_messages = @twitter.messages(:received)
An ArgumentError
will be raised if an invalid
action
is given. Valid actions are:
-
:received
-
:sent
# File lib/twitter/client/messaging.rb, line 19 def messages(action, options = {}) raise ArgumentError, "Invalid messaging action: #{action}" unless [:sent, :received].member?(action) uri = @@MESSAGING_URIS[action] response = rest_oauth_connect(:get, uri, options) bless_models(Twitter::Message.unmarshal(response.body)) end
Syntactic sugar for queries relating to authenticated user in Twitter's User API
Where action
is one of the following:
-
:info
- Returns user instance for the authenticated user. -
:friends
- Returns Array of users that are authenticated user's friends -
:followers
- Returns Array of users that are authenticated user's followers
Where options
is a Hash
of options that can
include:
-
:page
- optional. Retrieves the next set of friends. There are 100 friends per page. Default: 1. -
:lite
- optional. Prevents the inline inclusion of current status. Default: false. -
:since
- optional. Only relevant for:friends
action. Narrows the results to just those friends added after the date given as value of this option. Must be HTTP-formatted date.
An ArgumentError
will be raised if an invalid
action
is given. Valid actions are:
-
:info
-
:friends
-
:followers
# File lib/twitter/client/user.rb, line 60 def my(action, options = {}) raise ArgumentError, "Invalid user action: #{action}" unless @@USER_URIS.keys.member?(action) params = options.merge(:id => @login) uri = @@USER_URIS[action] response = rest_oauth_connect(:get, uri, params) users = Twitter::User.unmarshal(response.body) bless_models(users) end
Provides access to the Twitter Profile API.
You can update profile information. You can update the types of profile information:
-
:info (name, email, url, location, description)
-
:colors (background_color, text_color, link_color, sidebar_fill_color,
sidebar_border_color)
-
:device (set device to either “sms”, “im” or “none”)
Example:
user = client.profile(:info, :location => "University Library") puts user.inspect
# File lib/twitter/client/profile.rb, line 20 def profile(action, attributes) response = rest_oauth_connect(:post, @@PROFILE_URIS[action], attributes) bless_models(Twitter::User.unmarshal(response.body)) end
Provides access to Twitter's Search API.
Example:
# For keyword search iterator = @twitter.search(:q => "coworking") while (tweet = iterator.next) puts tweet.text end
An ArgumentError
will be raised if an invalid
action
is given. Valid actions are:
-
:received
-
:sent
# File lib/twitter/client/search.rb, line 19 def search(options = {}) uri = @@SEARCH_URIS[:basic] response = search_oauth_connect(:get, uri, options) json = JSON.parse(response.body) bless_models(Twitter::Status.unmarshal(JSON.dump(json["results"]))) end
Provides access to individual statuses via Twitter's Status APIs
action
can be of the following values:
-
:get
to retrieve status content. Assumesvalue
given responds to :to_i message in meaningful way to yield intended status id. -
:post
to publish a new status -
:delete
to remove an existing status. Assumesvalue
given responds to :to_i message in meaningful way to yield intended status id. -
:reply
to reply to an existing status. Assumesvalue
given isHash
which contains:in_reply_to_status_id
and:status
value
should be set to:
-
the status identifier for
:get
case -
the status text message for
:post
case -
none necessary for
:delete
case
Examples:
twitter.status(:get, 107786772) twitter.status(:post, "New Ruby open source project Twitter4R version 0.2.0 released.") twitter.status(:delete, 107790712) twitter.status(:reply, :in_reply_to_status_id => 1390482942342, :status => "@t4ruby This new v0.7.0 release is da bomb! #ruby #twitterapi #twitter4r") twitter.status(:post, "My brand new status in all its glory here tweeted from Greenwich (the real one). #withawesomehashtag #booyah", :lat => 0, :long => 0)
An ArgumentError
will be raised if an invalid
action
is given. Valid actions are:
-
:get
-
:post
-
:delete
The third argument options
sends on a Hash to the Twitter
API with the following keys allowed:
-
:lat
- latitude (for posting geolocation) -
:long
- longitude (for posting geolocation) -
:place_id
- using a place ID give by geo/reverse_geocode -
:display_coordinates
- whether or not to put a pin in the exact coordinates
# File lib/twitter/client/status.rb, line 40 def status(action, value = nil) return self.timeline_for(action, value || {}) if :replies == action raise ArgumentError, "Invalid status action: #{action}" unless @@STATUS_URIS.keys.member?(action) return nil unless value uri = @@STATUS_URIS[action] response = nil case action when :get response = rest_oauth_connect(:get, uri, {:id => value.to_i}) when :post if value.is_a?(Hash) params = value.delete_if { |k, v| ![:status, :lat, :long, :place_id, :display_coordinates].member?(k) } else params = {:status => value} end response = rest_oauth_connect(:post, uri, params.merge(:source => self.class.config.source)) when :delete response = rest_oauth_connect(:delete, uri, {:id => value.to_i}) when :reply return nil if (!value.is_a?(Hash) || !value[:status] || !value[:in_reply_to_status_id]) params = value.merge(:source => self.class.config.source) response = rest_oauth_connect(:post, uri, params) end bless_model(Twitter::Status.unmarshal(response.body)) end
Provides access to Twitter's Timeline APIs
Returns timeline for given type
.
type
can take the following values:
-
public
-
friends
orfriend
-
user
orme
:id
is on key applicable to be defined in
</tt>options</tt>:
-
the id or screen name (aka login) for :friends
-
the id or screen name (aka login) for :user
-
meaningless for the :me case, since
twitter.timeline_for(:user, 'mylogin')
andtwitter.timeline_for(:me)
are the same assuming 'mylogin' is the authenticated user's screen name (aka login).
Examples:
# returns the public statuses since status with id of 6543210 twitter.timeline_for(:public, id => 6543210) # returns the statuses for friend with user id 43210 twitter.timeline_for(:friend, :id => 43210) # returns the statuses for friend with screen name (aka login) of 'otherlogin' twitter.timeline_for(:friend, :id => 'otherlogin') # returns the statuses for user with screen name (aka login) of 'otherlogin' twitter.timeline_for(:user, :id => 'otherlogin')
options
can also include the following keys:
-
:id
is the user ID, screen name of Twitter::User representation of aTwitter
user. -
:since
is a Time object specifying the date-time from which to return results for. Applicable for the :friend, :friends, :user and :me cases. -
:count
specifies the number of statuses to retrieve at a time. Only applicable for the :user case. -
:page
specifies page number to retrieve. -
since_id
is the status id of the public timeline from which to retrieve statuses for:public
. Only applicable for the :public case. -
include_rts
flags whether to retrieve native retweets in the timeline or not. True values are true, t or 1.
You can also pass this method a block, which will iterate through the results of the requested timeline and apply the block logic for each status returned.
Example:
twitter.timeline_for(:public) do |status| puts status.user.screen_name, status.text end twitter.timeline_for(:friend, :id => 'myfriend', :since => 30.minutes.ago) do |status| puts status.user.screen_name, status.text end timeline = twitter.timeline_for(:me) do |status| puts status.text end
An ArgumentError
will be raised if an invalid
type
is given. Valid types are:
-
:public
-
:friends
-
:friend
-
:user
-
:me
-
:mentions
-
:replies
-
:retweetsbyme
-
:retweetstome
-
:retweetsofme
# File lib/twitter/client/timeline.rb, line 76 def timeline_for(type, options = {}, &block) raise ArgumentError, "Invalid timeline type: #{type}" unless @@TIMELINE_URIS.keys.member?(type) uri = @@TIMELINE_URIS[type] response = rest_oauth_connect(:get, uri, options) timeline = Twitter::Status.unmarshal(response.body) timeline.each {|status| bless_model(status); yield status if block_given? } timeline end
Provides access to the Twitter list trends API.
By default you will receive top ten topics that are trending on Twitter.
# File lib/twitter/client/trends.rb, line 14 def trends(type = :global) uri = @@TRENDS_URIS[type] response = rest_oauth_connect(:get, uri) if type === :locations bless_models(Twitter::Location.unmarshal(response.body)) else bless_models(Twitter::Trendline.unmarshal(response.body)) end end
Provides access to Twitter's User APIs
Returns user instance for the id
given. The id
can either refer to the numeric user ID or the user's screen name.
For example,
@twitter.user(234943) #=> Twitter::User object instance for user with numeric id of 234943 @twitter.user('mylogin') #=> Twitter::User object instance for user with screen name 'mylogin'
Where options
is a Hash
of options that can
include:
-
:page
- optional. Retrieves the next set of friends. There are 100 friends per page. Default: 1. -
:lite
- optional. Prevents the inline inclusion of current status. Default: false. -
:since
- optional. Only relevant for:friends
action. Narrows the results to just those friends added after the date given as value of this option. Must be HTTP-formatted date.
An ArgumentError
will be raised if an invalid
action
is given. Valid actions are:
-
:info
-
:friends
Note:
You should not use this method to attempt to retrieve
the authenticated user's followers. Please use any of the following
ways of accessing this list:
followers = client.my(:followers)
OR
followers = client.my(:info).followers
# File lib/twitter/client/user.rb, line 33 def user(id, action = :info, options = {}) raise ArgumentError, "Invalid user action: #{action}" unless @@USER_URIS.keys.member?(action) id = id.to_i if id.is_a?(Twitter::User) id_param = id.is_a?(String) ? :screen_name : :user_id params = options.merge(id_param => id) uri = @@USER_URIS[action] response = rest_oauth_connect(:get, uri, params) bless_models(Twitter::User.unmarshal(response.body)) end
Protected Instance Methods
“Blesses” model object with client information
# File lib/twitter/client/base.rb, line 39 def bless_model(model) model.bless(self) if model end
# File lib/twitter/client/base.rb, line 43 def bless_models(list) return bless_model(list) if list.respond_to?(:client=) list.collect { |model| bless_model(model) } if list.respond_to?(:collect) end
Returns the response of the OAuth/HTTP(s) request for REST API requests (not Search)
# File lib/twitter/client/base.rb, line 15 def rest_oauth_connect(method, path, params = {}, headers = {}, require_auth = true) atoken = rest_access_token uri = rest_request_uri(path, params) if [:get, :delete].include?(method) response = atoken.send(method, uri, http_header.merge(headers)) else response = atoken.send(method, uri, params, http_header.merge(headers)) end handle_rest_response(response) response end
Returns the response of the OAuth/HTTP(s) request for Search API requests (not REST)
# File lib/twitter/client/base.rb, line 28 def search_oauth_connect(method, path, params = {}, headers = {}, require_auth = true) atoken = search_access_token uri = search_request_uri(path, params) if method == :get response = atoken.send(method, uri, http_header.merge(headers)) end handle_rest_response(response) response end
Private Instance Methods
# File lib/twitter/client/base.rb, line 170 def construct_proxy_url cfg = self.class.config proxy_user, proxy_pass = cfg.proxy_user, cfg.proxy_pass proxy_host, proxy_port = cfg.proxy_host, cfg.proxy_port protocol = ((cfg.proxy_protocol == :ssl) ? :https : cfg.proxy_protocol).to_s url = nil if proxy_host url = "#{protocol}://" if proxy_user url << "#{proxy_user}:#{proxy_pass}@" end url << "#{proxy_host}:#{proxy_port.to_s}" else url end end
# File lib/twitter/client/base.rb, line 165 def construct_site_url(service = :rest) protocol, host, port, path_prefix = uri_components(service) "#{(protocol == :ssl ? :https : protocol).to_s}://#{host}:#{port}" end
# File lib/twitter/client/base.rb, line 122 def handle_rest_response(response, uri = nil) unless response.is_a?(Net::HTTPSuccess) raise_rest_error(response, uri) end end
# File lib/twitter/client/base.rb, line 128 def http_header # can cache this in class variable since all "variables" used to # create the contents of the HTTP header are determined by other # class variables that are not designed to change after instantiation. @@http_header ||= { 'User-Agent' => "Twitter4R v#{Twitter::Version.to_version} [#{self.class.config.user_agent}]", 'Accept' => 'text/x-json', 'X-Twitter-Client' => self.class.config.application_name, 'X-Twitter-Client-Version' => self.class.config.application_version, 'X-Twitter-Client-URL' => self.class.config.application_url, } @@http_header end
# File lib/twitter/client/base.rb, line 113 def raise_rest_error(response, uri = nil) map = JSON.parse(response.body) error = Twitter::RESTError.registry[response.code] raise error.new(:code => response.code, :message => response.message, :error => map["error"], :uri => uri) end
# File lib/twitter/client/base.rb, line 70 def rest_access_token unless @rest_access_token access = @oauth_access if access key = access[:key] || access["key"] secret = access[:secret] || access["secret"] else raise Error, "No access tokens are set" end @rest_access_token = OAuth::AccessToken.new(rest_consumer, key, secret) end @rest_access_token end
# File lib/twitter/client/base.rb, line 51 def rest_consumer unless @rest_consumer consumer = @oauth_consumer if consumer key = consumer[:key] || consumer["key"] secret = consumer[:secret] || consumer["secret"] end cfg = self.class.config key ||= cfg.oauth_consumer_token secret ||= cfg.oauth_consumer_secret @rest_consumer = OAuth::Consumer.new(key, secret, :site => construct_site_url, :proxy => construct_proxy_url) http = @rest_consumer.http http.read_timeout = cfg.timeout end @rest_consumer end
# File lib/twitter/client/base.rb, line 142 def rest_request_uri(path, params = nil) uri = "#{self.class.config.path_prefix}#{path}" uri << "?#{params.to_http_str}" if params uri end
# File lib/twitter/client/base.rb, line 104 def search_access_token unless @search_access_token key = @oauth_access[:key] || @oauth_access["key"] secret = @oauth_access[:secret] || @oauth_access["secret"] @search_access_token = OAuth::AccessToken.new(search_consumer, key, secret) end @search_access_token end
# File lib/twitter/client/base.rb, line 84 def search_consumer unless @search_consumer cfg = self.class.config consumer = @oauth_consumer if consumer key = consumer[:key] || consumer["key"] secret = consumer[:secret] || consumer["secret"] end cfg = self.class.config key ||= cfg.oauth_consumer_token secret ||= cfg.oauth_consumer_secret @search_consumer = OAuth::Consumer.new(key, secret, :site => construct_site_url(:search), :proxy => construct_proxy_url) http = @search_consumer.http http.read_timeout = cfg.timeout end @search_consumer end
# File lib/twitter/client/base.rb, line 148 def search_request_uri(path, params = nil) uri = "#{self.class.config.search_path_prefix}#{path}" uri << "?#{params.to_http_str}" if params uri end
# File lib/twitter/client/base.rb, line 154 def uri_components(service = :rest) case service when :rest return self.class.config.protocol, self.class.config.host, self.class.config.port, self.class.config.path_prefix when :search return self.class.config.search_protocol, self.class.config.search_host, self.class.config.search_port, self.class.config.search_path_prefix end end
# File lib/twitter/client/auth.rb, line 17 def verify_credentials(username, passwd) response = rest_oauth_connect(:get, "#{@@AUTHENTICATION_URIS[:verify]}.json") response.is_a?(Net::HTTPSuccess) ? true : false end