Class: CMIS::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/cmis/server.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Server



3
4
5
# File 'lib/cmis/server.rb', line 3

def initialize(options = {})
  @options = options.symbolize_keys
end

Instance Method Details

#execute!(params = {}, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/cmis/server.rb', line 7

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

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

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

#inspectObject



40
41
42
# File 'lib/cmis/server.rb', line 40

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

#repositories(opts = {}) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/cmis/server.rb', line 18

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

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

#repository(repository_id, opts = {}) ⇒ Object



26
27
28
29
30
31
# File 'lib/cmis/server.rb', line 26

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

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

#repository?(repository_id) ⇒ Boolean



33
34
35
36
37
38
# File 'lib/cmis/server.rb', line 33

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