lib/soaspec/exchange_handlers/rest_handler.rb in soaspec-0.1.16 vs lib/soaspec/exchange_handlers/rest_handler.rb in soaspec-0.1.17
- old
+ new
@@ -276,12 +276,20 @@
methods = %w[post patch put get delete]
methods.each do |rest_method|
# Make REST Exchange within this Handler context
- # @param [Hash] params Exchange parameters
+ # @param [Hash, String] params Exchange parameters. If String is used it will be for suburl
# @return [Exchange] Instance of Exchange class. Assertions are made by default on the response body
define_method(rest_method) do |params = {}|
+ unless params.is_a? Hash
+ params = case rest_method
+ when 'get', 'delete'
+ { suburl: params.to_s }
+ else
+ params
+ end
+ end
params[:name] ||= rest_method
exchange_params = { name: params[:name] }
if params[:template_name]
exchange_params[:template_name] = params[:template_name]
params.delete :template_name