module Scrivito class ResolvePathsController < WebserviceController def resolve link_parser = LinkParser.new(request.host, request.port) @paths = assert_paths.map do |path| link_parser.parse(path).obj.try(:id) end end private def assert_paths raise ClientError.new('paths is not given or not an Array') unless Array === params[:paths] unless params[:paths].all? { |path| String === path } raise ClientError.new('paths is not an Array of Strings') end params[:paths] end end end