/cmis-ruby

Ruby client for CMIS

Primary LanguageRubyApache License 2.0Apache-2.0

CMIS ruby

Gem Version Dependency Status Code Climate

CMIS ruby is a CMIS client library, using the the CMIS Browser Binding (CMIS 1.1).

Example usage

require 'cmis'

# get the repository object
server = CMIS::Server.new(service_url: 'http://33.33.33.100:8080/browser',
                          username: 'foo', password: 'bar')
repository = server.repository('my_repository')

# get object by object id
document = repository.object('f3y5wbb6slhkeq3ciu3uazbpxeu')

# or by unique property
document = repository.find_object('cmis:document',
                                  'cmis:name' => 'some_unique_name')

# set document content
document.content = { stream: 'Apple is a fruit',
                     mime_type: 'text/plain',
                     filename: 'apple.txt' }

# create a new document
document = repository.new_document
document.name = 'new_document'
document.object_type_id = 'cmis:document'
document = document.create_in_folder(repository.root)

# query for first 50 documents where the property 'cmis:name' is 'bar'
query = repository.query("select * from cmis:document where cmis:name='bar'")
query.each_result(limit: 50) { |document| puts document.cmis_object_id }

Running specs

The default rake task runs the specs. This requires a separate CMIS server. The environment variable TEST_ENV selects the test environment from spec/config.yml.

Contributing

Write some code. Run the specs. Open a pull request.