Class: Twitter::HTTPAuth

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/twitter/httpauth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, password, options = {}) ⇒ HTTPAuth

Returns a new instance of HTTPAuth.



9
10
11
12
13
14
15
16
# File 'lib/twitter/httpauth.rb', line 9

def initialize(username, password, options={})
  warn "[DEPRECATION] Baic auth is deprecated as Twitter is ending support in June 2010. Please migrate to OAuth."
  
  @username, @password = username, password
  @options = {:ssl => false}.merge(options)
  options[:api_endpoint] ||= "api.twitter.com"
  self.class.base_uri "http#{'s' if options[:ssl]}://#{options[:api_endpoint]}"
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/twitter/httpauth.rb', line 7

def options
  @options
end

#passwordObject (readonly)

Returns the value of attribute password.



7
8
9
# File 'lib/twitter/httpauth.rb', line 7

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



7
8
9
# File 'lib/twitter/httpauth.rb', line 7

def username
  @username
end

Instance Method Details

#delete(uri, body = {}, headers = {}) ⇒ Object



36
37
38
39
40
# File 'lib/twitter/httpauth.rb', line 36

def delete(uri, body={}, headers={})
  warn "[DEPRECATION] Baic auth is deprecated as Twitter is ending support in June 2010. Please migrate to OAuth."
  
  self.class.delete(uri, :body => body, :headers => headers, :basic_auth => basic_auth)
end

#get(uri, headers = {}) ⇒ Object



18
19
20
21
22
# File 'lib/twitter/httpauth.rb', line 18

def get(uri, headers={})
  warn "[DEPRECATION] Baic auth is deprecated as Twitter is ending support in June 2010. Please migrate to OAuth."
  
  self.class.get(uri, :headers => headers, :basic_auth => basic_auth)
end

#post(uri, body = {}, headers = {}) ⇒ Object



24
25
26
27
28
# File 'lib/twitter/httpauth.rb', line 24

def post(uri, body={}, headers={})
  warn "[DEPRECATION] Baic auth is deprecated as Twitter is ending support in June 2010. Please migrate to OAuth."
  
  self.class.post(uri, :body => body, :headers => headers, :basic_auth => basic_auth)
end

#put(uri, body = {}, headers = {}) ⇒ Object



30
31
32
33
34
# File 'lib/twitter/httpauth.rb', line 30

def put(uri, body={}, headers={})
  warn "[DEPRECATION] Baic auth is deprecated as Twitter is ending support in June 2010. Please migrate to OAuth."
  
  self.class.put(uri, :body => body, :headers => headers, :basic_auth => basic_auth)
end