Sha256: 2fbd16a7178e5fd398bdd8e7effe71c534c1b54779e93a952d60a2e2ff8f8cfe

Contents?: true

Size: 569 Bytes

Versions: 7

Compression:

Stored size: 569 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 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

7 entries across 7 versions & 1 rubygems

Version Path
scrivito_sdk-1.4.3 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.4.2 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.4.1 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.4.1.rc1 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.4.0 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.4.0.rc2 app/controllers/scrivito/resolve_paths_controller.rb
scrivito_sdk-1.4.0.rc1 app/controllers/scrivito/resolve_paths_controller.rb