Class: Twitter::HTTPAuth
- Inherits:
-
Object
- Object
- Twitter::HTTPAuth
- Includes:
- HTTParty
- Defined in:
- lib/twitter/httpauth.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #get(uri, headers = {}) ⇒ Object
-
#initialize(username, password, options = {}) ⇒ HTTPAuth
constructor
A new instance of HTTPAuth.
- #post(uri, body = {}, headers = {}) ⇒ Object
Constructor Details
#initialize(username, password, options = {}) ⇒ HTTPAuth
Returns a new instance of HTTPAuth.
8 9 10 11 12 |
# File 'lib/twitter/httpauth.rb', line 8 def initialize(username, password, ={}) @username, @password = username, password @options = {:ssl => false}.merge() self.class.base_uri "http#{'s' if [:ssl]}://twitter.com" end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/twitter/httpauth.rb', line 6 def @options end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
6 7 8 |
# File 'lib/twitter/httpauth.rb', line 6 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
6 7 8 |
# File 'lib/twitter/httpauth.rb', line 6 def username @username end |
Instance Method Details
#get(uri, headers = {}) ⇒ Object
14 15 16 |
# File 'lib/twitter/httpauth.rb', line 14 def get(uri, headers={}) self.class.get(uri, :headers => headers, :basic_auth => basic_auth) end |
#post(uri, body = {}, headers = {}) ⇒ Object
18 19 20 |
# File 'lib/twitter/httpauth.rb', line 18 def post(uri, body={}, headers={}) self.class.post(uri, :body => body, :headers => headers, :basic_auth => basic_auth) end |