Created
November 1, 2008 02:48
-
-
Save mojodna/21466 to your computer and use it in GitHub Desktop.
OAuth::RequestProxy for Hashes to facilitate simpler signature creation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module OAuth | |
module RequestProxy | |
# 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" | |
# } | |
# | |
# # can't pass options unless they respond to :secret, so use this alternative | |
# signature = OAuth::Signature.sign(request) do |token| | |
# [oauth_token_secret, oauth_consumer_secret] | |
# end | |
class MockRequest < OAuth::RequestProxy::Base | |
proxies Hash | |
def parameters | |
@request["parameters"] | |
end | |
def method | |
@request["method"] | |
end | |
def uri | |
@request["uri"] | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment