Sha256: d85a0fbd87dc5c1f9c6cf513ee9accaf8b126f0f4824481062120ee19fccc98b

Contents?: true

Size: 721 Bytes

Versions: 51

Compression:

Stored size: 721 Bytes

Contents

module Scrivito
  class ResolvePathsController < WebserviceController
    def resolve
      link_parser = LinkParser.new(request.host, request.port)
      @paths = assert_paths.map do |path|
        link = link_parser.parse(path)
        next if link.external?
        {
          'obj_id' => link.obj.id,
          'query' => link.query,
          'fragment' => link.fragment,
        }
      end
    end

    private

    def assert_paths
      raise ClientError.new('paths is not given or not an Array') unless params[:paths].is_a?(Array)
      unless params[:paths].all? { |path| path.is_a?(String) }
        raise ClientError.new('paths is not an Array of Strings')
      end

      params[:paths]
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
scrivito_sdk-1.18.0 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.18.0.rc1 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.17.0 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.17.0.rc3 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.17.0.rc2 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.17.0.rc1 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.16.0 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.16.0.rc2 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.16.0.rc1 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.15.0 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.15.0.rc2 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.15.0.rc1 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.14.0 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.14.0.rc3 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.14.0.rc2 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.14.0.rc1 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.13.0 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.13.0.rc2 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.13.0.rc1 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.12.0 app/controllers/scrivito/resolve_paths_controller.rb