Sha256: c0461e0394f368762d927b311a206b2e6ee503bdbb85547ca476473f55c9d82c

Contents?: true

Size: 1.25 KB

Versions: 18

Compression:

Stored size: 1.25 KB

Contents

module CMIS
  class Server
    def initialize(options = {})
      @options = options.symbolize_keys
    end

    def connection
      @connection ||= Connection.new(@options)
    end

    def execute!(params = {}, options = {})
      params.symbolize_keys!

      options.symbolize_keys!
      query = options.fetch(:query, {})
      headers = options.fetch(:headers, {})

      connection.do_request(params, query, headers).body
    end

    def repositories(opts = {})
      result = execute!({}, opts)

      result.values.map do |r|
        Repository.new(r, self)
      end
    end

    def repository(repository_id, opts = {})
      result = execute!({ cmisselector: 'repositoryInfo',
                          repositoryId: repository_id }, opts)

      Repository.new(result[repository_id], self)
    end

    def repository_by_name(repository_name, opts = {})
      repositories(opts).find { |r| r.name == repository_name }
    end

    def repository?(repository_id)
      repository(repository_id)
      true
    rescue Exceptions::ObjectNotFound
      false
    end

    def inspect
      "#{self.class}[#{@options[:service_url]}]"
    end

    private

    def marshal_dump
      @options
    end

    def marshal_load(options)
      @options = options
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
cmis-ruby-0.5.38 lib/cmis/server.rb
cmis-ruby-0.5.37 lib/cmis/server.rb
cmis-ruby-0.5.36 lib/cmis/server.rb
cmis-ruby-0.5.35 lib/cmis/server.rb
cmis-ruby-0.5.34 lib/cmis/server.rb
cmis-ruby-0.5.33 lib/cmis/server.rb
cmis-ruby-0.5.32 lib/cmis/server.rb
cmis-ruby-0.5.31 lib/cmis/server.rb
cmis-ruby-0.5.30 lib/cmis/server.rb
cmis-ruby-0.5.29 lib/cmis/server.rb
cmis-ruby-0.5.28 lib/cmis/server.rb
cmis-ruby-0.5.27 lib/cmis/server.rb
cmis-ruby-0.5.26 lib/cmis/server.rb
cmis-ruby-0.5.25 lib/cmis/server.rb
cmis-ruby-0.5.24 lib/cmis/server.rb
cmis-ruby-0.5.23 lib/cmis/server.rb
cmis-ruby-0.5.22 lib/cmis/server.rb
cmis-ruby-0.5.21 lib/cmis/server.rb