Class: ChefAnalytics::HTTP::TokenAuthenticator
- Inherits:
-
Object
- Object
- ChefAnalytics::HTTP::TokenAuthenticator
- Defined in:
- lib/chef-analytics/http/token_authenticator.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #handle_request(method, url, headers = {}, data = false) ⇒ Object
- #handle_response(http_response, rest_request, return_value) ⇒ Object
- #handle_stream_complete(http_response, rest_request, return_value) ⇒ Object
-
#initialize(opts = {}) ⇒ TokenAuthenticator
constructor
A new instance of TokenAuthenticator.
- #stream_response_handler(response) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ TokenAuthenticator
Returns a new instance of TokenAuthenticator.
24 25 26 |
# File 'lib/chef-analytics/http/token_authenticator.rb', line 24 def initialize(opts={}) @token = opts[:authentication_token] end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
22 23 24 |
# File 'lib/chef-analytics/http/token_authenticator.rb', line 22 def token @token end |
Instance Method Details
#handle_request(method, url, headers = {}, data = false) ⇒ Object
28 29 30 31 |
# File 'lib/chef-analytics/http/token_authenticator.rb', line 28 def handle_request(method, url, headers={}, data=false) headers.merge!(@token.authentication_header) [method, url, headers, data] end |
#handle_response(http_response, rest_request, return_value) ⇒ Object
33 34 35 |
# File 'lib/chef-analytics/http/token_authenticator.rb', line 33 def handle_response(http_response, rest_request, return_value) [http_response, rest_request, return_value] end |
#handle_stream_complete(http_response, rest_request, return_value) ⇒ Object
41 42 43 |
# File 'lib/chef-analytics/http/token_authenticator.rb', line 41 def handle_stream_complete(http_response, rest_request, return_value) [http_response, rest_request, return_value] end |
#stream_response_handler(response) ⇒ Object
37 38 39 |
# File 'lib/chef-analytics/http/token_authenticator.rb', line 37 def stream_response_handler(response) nil end |