Sha256: 84cf3f1cc66479293b852010de7e1ba9050594d665d4e82ba986f505b93346f7

Contents?: true

Size: 695 Bytes

Versions: 7

Compression:

Stored size: 695 Bytes

Contents

module CMIS
  class Connection
    class URLResolver
      def initialize(http, service_url)
        @http = http
        @service_url = service_url
        @repository_infos = {}
      end

      def url(repository_id, object_id)
        return @service_url unless repository_id

        unless @repository_infos.key?(repository_id)
          @repository_infos = @http.get(@service_url).body
        end

        if @repository_infos.key?(repository_id)
          key = object_id ? 'rootFolderUrl' : 'repositoryUrl'
          @repository_infos[repository_id][key]
        else
          raise Exceptions::ObjectNotFound, "repositoryId: #{repository_id}"
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cmis-ruby-0.4.7 lib/cmis/connection/url_resolver.rb
cmis-ruby-0.4.6 lib/cmis/connection/url_resolver.rb
cmis-ruby-0.4.5 lib/cmis/connection/url_resolver.rb
cmis-ruby-0.4.4 lib/cmis/connection/url_resolver.rb
cmis-ruby-0.4.3 lib/cmis/connection/url_resolver.rb
cmis-ruby-0.4.2 lib/cmis/connection/url_resolver.rb
cmis-ruby-0.4.1 lib/cmis/connection/url_resolver.rb