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) ⇒ HTTPAuth

Returns a new instance of HTTPAuth.



9
10
11
# File 'lib/twitter/httpauth.rb', line 9

def initialize(username, password)
  @username, @password = username, password
end

Instance Attribute Details

#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

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



13
14
15
# File 'lib/twitter/httpauth.rb', line 13

def get(uri, headers={})
  self.class.get(uri, :headers => headers, :basic_auth => basic_auth)
end

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



17
18
19
# File 'lib/twitter/httpauth.rb', line 17

def post(uri, body={}, headers={})
  self.class.post(uri, :body => body, :headers => headers, :basic_auth => basic_auth)
end