MistralClient provides a Ruby interface to a limited subset of the Mistral API.
Add this line to your application's Gemfile:
gem 'mistral_client'And then execute:
$ bundle
Or install it yourself as:
$ gem install mistral_client
The Mistral base URL is required:
client = MistralClient.new('https://mistral.local/v2')If running Mistral with a self-signed certificate (e.g., during development),
you can bypass certificate verification by specifying verify: false:
client = MistralClient.new('https://mistral.local/v2', verify: false)You can also pass in other connection options in the same way you would with HTTParty:
client = MistralClient.new('https://mistral.local/v2', timeout: 20)environment = client.environment(definition)environment.delete!workflow = client.workflow(definition)You can instantiate a workflow object using an existing Mistral workflow ID:
workflow = client.workflow(id: id)or workflow name:
workflow = client.workflow(name: name)workflow.execute!If your workflow uses an environment, you can specify the environment with the
env keyword argument:
workflow.execute!(env: name)execution.patch(state: 'CANCELLED')task.patch(state: 'RUNNING', reset: true)workflow.delete!client.workflow.valid?(definition)You can also get validation error details:
client.workflow.validate(definition)After checking out the repo, run bin/setup to install dependencies. Then, run
rake to run the tests. You can also run bin/console for an interactive
prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To
release a new version, update the version number in version.rb, and then run
bundle exec rake release, which will create a git tag for the version, push
git commits and tags, and push the .gem file
to rubygems.org.
Recording new cassettes is as simple as ensuring you have a Mistral server
available at the LOCAL_MISTRAL_URL defined in spec/spec_helper.rb and
running rake. To rerecord existing cassettes, simply remove the relevant
cassettes from spec/cassettes and run rake.
See CONTRIBUTING.
MistralClient is released under the BSD 3-Clause License.