arg = arg.dup
request = arg.keys.detect {|key| key.is_a?(String)}
raise ArgumentError unless request
- options = arg.slice!(request)
+ options = arg.slice!(request)
raise ArgumentError unless request =~ /\A(GET|POST|PUT|PATCH|DELETE)\s+(.+)\z/
- method, path = $1.downcase.to_sym, $2
+ method, path = $1.downcase.to_sym, $2
raise ArgumentError unless arg.values.first =~ /\A(.+)#(.+)\z/
- controller, action = $1, $2
+ controller, action = $1, $2
assert_routing(
{:method => method, :path => path},
options.merge(:controller => controller, :action => action)
unless response.content_type.to_s =~ /^application\/(.+)/
raise "Unexpected response type: #{response.content_type}"
end
+
format = $1
case format
when 'xml'
arg = arg.dup
request = arg.keys.detect {|key| key.is_a?(String)}
raise ArgumentError unless request
+
options = arg.slice!(request)
API_FORMATS.each do |format|