Skip to content

Commit

Permalink
Remove Twitter#client?
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Aug 5, 2013
1 parent 06e0554 commit a58474e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
20 changes: 5 additions & 15 deletions lib/twitter.rb
Expand Up @@ -40,29 +40,19 @@ class << self
#
# @return [Twitter::Client]
def client
return @client if instance_variable_defined?(:"@client") && @client.hash == options.hash
return @client if instance_variable_defined?(:@client) && @client.hash == options.hash
@client = Twitter::Client.new(options)
end

# Has a client been initialized on the Twitter module
#
# @return [Boolean]
def client?
!!client
def method_missing(method_name, *args, &block)
return super unless respond_to_missing?(method_name)
client.send(method_name, *args, &block)
end

def respond_to_missing?(method_name, include_private=false)
client.respond_to?(method_name, include_private)
end

private

def method_missing(method_name, *args, &block)
return super unless respond_to_missing?(method_name)
client.send(method_name, *args, &block)
end

end
setup
end

Twitter.setup
5 changes: 1 addition & 4 deletions lib/twitter/client.rb
Expand Up @@ -93,10 +93,7 @@ def request_setup(method, path, params, signature_params)
request.headers[:content_type] = 'application/x-www-form-urlencoded; charset=UTF-8'
request.headers[:accept] = '*/*' # It is important we set this, otherwise we get an error.
elsif params.delete(:app_auth) || !user_token?
unless bearer_token?
@bearer_token = token
Twitter.client.bearer_token = @bearer_token if Twitter.client?
end
@bearer_token = token unless bearer_token?
request.headers[:authorization] = bearer_auth_header
else
request.headers[:authorization] = oauth_auth_header(method, path, signature_params).to_s
Expand Down

0 comments on commit a58474e

Please sign in to comment.