Class: ActionDispatch::TestRequest
- Defined in:
- lib/oauth/request_proxy/action_dispatch_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
75 76 77 |
# File 'lib/oauth/request_proxy/action_dispatch_request.rb', line 75 def self.use_oauth=(bool) @use_oauth = bool end |
.use_oauth? ⇒ Boolean
79 80 81 |
# File 'lib/oauth/request_proxy/action_dispatch_request.rb', line 79 def self.use_oauth? @use_oauth end |
Instance Method Details
#apply_oauth! ⇒ Object
92 93 94 95 96 97 98 99 |
# File 'lib/oauth/request_proxy/action_dispatch_request.rb', line 92 def apply_oauth! return unless ActionDispatch::TestRequest.use_oauth? && @oauth_options @oauth_helper = OAuth::Client::Helper.new(self, @oauth_options.merge(:request_uri => (respond_to?(:fullpath) ? fullpath : request_uri))) @oauth_helper.amend_user_agent_header(env) self.send("set_oauth_#{@oauth_options[:scheme]}") end |
#configure_oauth(consumer = nil, token = nil, options = {}) ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/oauth/request_proxy/action_dispatch_request.rb', line 83 def configure_oauth(consumer = nil, token = nil, = {}) @oauth_options = { :consumer => consumer, :token => token, :scheme => 'header', :signature_method => nil, :nonce => nil, :timestamp => nil }.merge() end |
#set_oauth_header ⇒ Object
101 102 103 |
# File 'lib/oauth/request_proxy/action_dispatch_request.rb', line 101 def set_oauth_header env['Authorization'] = @oauth_helper.header end |
#set_oauth_parameters ⇒ Object
105 106 107 108 |
# File 'lib/oauth/request_proxy/action_dispatch_request.rb', line 105 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
110 111 |
# File 'lib/oauth/request_proxy/action_dispatch_request.rb', line 110 def set_oauth_query_string end |