class CMIS::Server

Public Class Methods

new(options = {}) click to toggle source
# File lib/cmis/server.rb, line 3
def initialize(options = {})
  @options = options.symbolize_keys
end

Public Instance Methods

connection() click to toggle source
# File lib/cmis/server.rb, line 7
def connection
  @connection ||= Connection.new(@options)
end
execute!(params = {}, options = {}) click to toggle source
# File lib/cmis/server.rb, line 11
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
inspect() click to toggle source
# File lib/cmis/server.rb, line 47
def inspect
  "#{self.class}[#{@options[:service_url]}]"
end
repositories(opts = {}) click to toggle source
# File lib/cmis/server.rb, line 21
def repositories(opts = {})
  result = execute!({}, opts)

  result.values.map do |r|
    Repository.new(r, self)
  end
end
repository(repository_id, opts = {}) click to toggle source
# File lib/cmis/server.rb, line 29
def repository(repository_id, opts = {})
  result = execute!({ cmisselector: 'repositoryInfo',
                      repositoryId: repository_id }, opts)

  Repository.new(result[repository_id], self)
end
repository?(repository_id) click to toggle source
# File lib/cmis/server.rb, line 40
def repository?(repository_id)
  repository(repository_id)
  true
rescue Exceptions::ObjectNotFound
  false
end
repository_by_name(repository_name, opts = {}) click to toggle source
# File lib/cmis/server.rb, line 36
def repository_by_name(repository_name, opts = {})
  repositories(opts).find { |r| r.name == repository_name }
end

Private Instance Methods

marshal_dump() click to toggle source
# File lib/cmis/server.rb, line 53
def marshal_dump
  @options
end
marshal_load(options) click to toggle source
# File lib/cmis/server.rb, line 57
def marshal_load(options)
  @options = options
end