Class: OAuthClient
- Inherits:
-
HTTPClient
- Object
- HTTPClient
- OAuthClient
- Defined in:
- lib/oauthclient.rb
Overview
OAuthClient provides OAuth related methods in addition to HTTPClient.
TODO
Constant Summary
Constants inherited from HTTPClient
HTTPClient::LIB_NAME, HTTPClient::PROPFIND_DEFAULT_EXTHEADER, HTTPClient::RUBY_VERSION_STRING, HTTPClient::VERSION
Instance Attribute Summary collapse
-
#oauth_config ⇒ Object
Returns the value of attribute oauth_config.
Attributes inherited from HTTPClient
#cookie_manager, #follow_redirect_count, #proxy_auth, #request_filter, #ssl_config, #test_loopback_response, #www_auth
Instance Method Summary collapse
- #get_access_token(uri, request_token, request_token_secret, verifier = nil) ⇒ Object
- #get_request_token(uri, callback = nil, param = nil) ⇒ Object
-
#initialize(*arg) ⇒ OAuthClient
constructor
A new instance of OAuthClient.
Methods inherited from HTTPClient
#debug_dev, #debug_dev=, #default_redirect_uri_callback, #delete, #delete_async, #get, #get_async, #get_content, #head, #head_async, #no_proxy, #no_proxy=, #options, #options_async, #post, #post_async, #post_content, #propfind, #propfind_async, #proppatch, #proppatch_async, #proxy, #proxy=, #put, #put_async, #redirect_uri_callback=, #request, #request_async, #reset, #reset_all, #save_cookie_store, #set_auth, #set_basic_auth, #set_cookie_store, #set_proxy_auth, #strict_redirect_uri_callback, timeout_scheduler, #trace, #trace_async
Methods included from HTTPClient::Util
hash_find_value, #keyword_argument, uri_dirname, uri_part_of, #urify
Constructor Details
#initialize(*arg) ⇒ OAuthClient
Returns a new instance of OAuthClient.
24 25 26 27 28 29 |
# File 'lib/oauthclient.rb', line 24 def initialize(*arg) super @oauth_config = HTTPClient::OAuth::Config.new self.www_auth.oauth.set_config(nil, @oauth_config) self.www_auth.oauth.challenge(nil) end |
Instance Attribute Details
#oauth_config ⇒ Object
Returns the value of attribute oauth_config.
22 23 24 |
# File 'lib/oauthclient.rb', line 22 def oauth_config @oauth_config end |
Instance Method Details
#get_access_token(uri, request_token, request_token_secret, verifier = nil) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/oauthclient.rb', line 41 def get_access_token(uri, request_token, request_token_secret, verifier = nil) oauth_config.token = request_token oauth_config.secret = request_token_secret oauth_config.callback = nil oauth_config.verifier = verifier res = request(oauth_config.http_method, uri) filter_response(res) res end |
#get_request_token(uri, callback = nil, param = nil) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/oauthclient.rb', line 31 def get_request_token(uri, callback = nil, param = nil) oauth_config.token = nil oauth_config.secret = nil oauth_config.callback = callback oauth_config.verifier = nil res = request(oauth_config.http_method, uri, param) filter_response(res) res end |