Class: OAuth::RequestProxy::MockRequest

Inherits:
Base show all
Defined in:
lib/oauth/request_proxy/mock_request.rb

Overview

RequestProxy for Hashes to facilitate simpler signature creation. Usage:

request = OAuth::RequestProxy.proxy \
   "method" => "iq",
   "uri"    => [from, to] * "&",
   "parameters" => {
     "oauth_consumer_key"     => oauth_consumer_key,
     "oauth_token"            => oauth_token,
     "oauth_signature_method" => "HMAC-SHA1"
   }

signature = OAuth::Signature.sign \
  request,
  :consumer_secret => oauth_consumer_secret,
  :token_secret    => oauth_token_secret,

Instance Attribute Summary

Attributes inherited from Base

#options, #request, #unsigned_parameters

Instance Method Summary collapse

Methods inherited from Base

#initialize, #non_oauth_parameters, #normalized_parameters, #oauth_callback, #oauth_consumer_key, #oauth_header, #oauth_nonce, #oauth_parameters, #oauth_signature, #oauth_signature_method, #oauth_timestamp, #oauth_token, #oauth_verifier, #oauth_version, #parameters_for_signature, proxies, #query_string_blank?, #sign, #sign!, #signature_base_string, #signed?, #signed_uri

Methods included from Helper

#escape, #generate_key, #generate_timestamp, #normalize, #parse_header, #stringify_keys, #unescape

Constructor Details

This class inherits a constructor from OAuth::RequestProxy::Base

Instance Method Details

#methodObject



27
28
29
# File 'lib/oauth/request_proxy/mock_request.rb', line 27

def method
  @request["method"]
end

#normalized_uriObject



31
32
33
34
35
36
37
# File 'lib/oauth/request_proxy/mock_request.rb', line 31

def normalized_uri
  super
rescue
  # if this is a non-standard URI, it may not parse properly
  # in that case, assume that it's already been normalized
  uri
end

#parametersObject



23
24
25
# File 'lib/oauth/request_proxy/mock_request.rb', line 23

def parameters
  @request["parameters"]
end

#uriObject



39
40
41
# File 'lib/oauth/request_proxy/mock_request.rb', line 39

def uri
  @request["uri"]
end