Class: ActionController::TestRequest
- Inherits:
-
Object
- Object
- ActionController::TestRequest
- Defined in:
- lib/oauth/client/action_controller_request.rb
Class Method Summary collapse
Instance Method Summary collapse
- #apply_oauth! ⇒ Object
- #configure_oauth(consumer = nil, token = nil, options = {}) ⇒ Object
- #set_oauth_header ⇒ Object
- #set_oauth_parameters ⇒ Object
- #set_oauth_query_string ⇒ Object
Class Method Details
.use_oauth=(bool) ⇒ Object
16 17 18 |
# File 'lib/oauth/client/action_controller_request.rb', line 16 def self.use_oauth=(bool) @use_oauth = bool end |
.use_oauth? ⇒ Boolean
20 21 22 |
# File 'lib/oauth/client/action_controller_request.rb', line 20 def self.use_oauth? @use_oauth end |
Instance Method Details
#apply_oauth! ⇒ Object
33 34 35 36 37 38 |
# File 'lib/oauth/client/action_controller_request.rb', line 33 def apply_oauth! return unless ActionController::TestRequest.use_oauth? && @oauth_helper = OAuth::Client::Helper.new(self, .merge( { :request_uri => request_uri } )) self.send("set_oauth_#{@oauth_options[:scheme]}") end |
#configure_oauth(consumer = nil, token = nil, options = {}) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/oauth/client/action_controller_request.rb', line 24 def configure_oauth(consumer = nil, token = nil, = {}) = { :consumer => consumer, :token => token, :scheme => 'header', :signature_method => nil, :nonce => nil, :timestamp => nil }.merge() end |
#set_oauth_header ⇒ Object
40 41 42 |
# File 'lib/oauth/client/action_controller_request.rb', line 40 def set_oauth_header env['Authorization'] = @oauth_helper.header end |
#set_oauth_parameters ⇒ Object
44 45 46 47 |
# File 'lib/oauth/client/action_controller_request.rb', line 44 def set_oauth_parameters @query_parameters = @oauth_helper.parameters_with_oauth @query_parameters.merge!( { :oauth_signature => @oauth_helper.signature } ) end |
#set_oauth_query_string ⇒ Object
49 50 |
# File 'lib/oauth/client/action_controller_request.rb', line 49 def set_oauth_query_string end |