module ApiSigv2::SpecSupport::Helper
Public Instance Methods
app()
click to toggle source
# File lib/api_sigv2/spec_support/helper.rb, line 11 def app Rails.app_class end
delete_with_signature(client, *args)
click to toggle source
# File lib/api_sigv2/spec_support/helper.rb, line 29 def delete_with_signature(client, *args) with_signature(:delete, client.api_key, client.api_secret, *args) end
get_with_signature(client, *args)
click to toggle source
# File lib/api_sigv2/spec_support/helper.rb, line 15 def get_with_signature(client, *args) with_signature(:get, client.api_key, client.api_secret, *args) end
post_with_signature(client, *args)
click to toggle source
# File lib/api_sigv2/spec_support/helper.rb, line 19 def post_with_signature(client, *args) with_signature(:post, client.api_key, client.api_secret, *args) end
put_with_signature(client, *args)
click to toggle source
# File lib/api_sigv2/spec_support/helper.rb, line 23 def put_with_signature(client, *args) with_signature(:put, client.api_key, client.api_secret, *args) end
Also aliased as: patch_with_signature
Private Instance Methods
with_signature(http_method, api_key, secret, action_name, params = {})
click to toggle source
# File lib/api_sigv2/spec_support/helper.rb, line 35 def with_signature(http_method, api_key, secret, action_name, params = {}) custom_headers = (params.delete(:headers) || {}) path = PathBuilder.new(controller, action_name, params).path signature = Signer.new(api_key, secret).sign_request( http_method: http_method.to_s.upcase, url: path, headers: custom_headers ) send(http_method, path, params, signature.headers) end