Easy-Exist
An easy to use gem to interact with eXist-db via its REST API.
Code Example
require 'easy-exist'
# connect
db = EasyExist::DB.new("http://localhost:8080", {
username: "user", password: "easy"
})
# add a document
body = "<message><body>Hello World</body></message>"
db.put("/my-collection/my-document", body)
# get document body
doc = db.get("/my-collection/my-document")
# query for all message bodies
bodies = db.query("collection('my-collection')/message/body");
# delete the document
db.delete("/my-collection/my-document")
Installation
Simply add easy-exist to your Gemfile
source 'https://rubygems.org'
gem 'easy-exist'
Then install via bundler
bundle install
Running Tests
RSpec is used for tests.
The tests run against a local exist-db instance under a "test-user" account. If you want to run the tests yourself, ensure that this test-user account has been created. You can update the connection properties in spec/db_spec.rb
let(:db) {
EasyExist::DB.new("http://localhost:8088", {
username: "test-user",
password: "password"
})
}
API Reference
See the Docs
Contributing
- Fork the project.
- Create your branch
- Commit your changes with tests
- Create a Pull Request