Skip to content

Instantly share code, notes, and snippets.

@mojodna

mojodna/gist:21466

Created Nov 1, 2008
Embed
What would you like to do?
OAuth::RequestProxy for Hashes to facilitate simpler signature creation.
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
You can’t perform that action at this time.