Sha256: f8d65f35d3a2e297838b9e3eea0c97b81b31df7c7a7a00f64cae6b5bca597bf5

Contents?: true

Size: 563 Bytes

Versions: 6

Compression:

Stored size: 563 Bytes

Contents

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
scrivito_sdk-1.3.1 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.3.1.rc1 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.3.0 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.3.0.rc3 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.3.0.rc2 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.3.0.rc1 app/controllers/scrivito/resolve_paths_controller.rb