Manifest.ly Ruby Client
A Ruby client that enables quick and easy interactions with the Manifest.ly api.
Getting Started
Installation
Add this line to your application's Gemfile:
gem 'manifestly-client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install manifestly-client
Basic Usage
You may begin using the entity methods after specifying the MANIFESTLY_API_KEY variable in the environment.
require 'manifestly'
ENV['MANIFESTLY_API_KEY'] = '<secret>'
puts Manifestly::Entity::Workflow.list.inspect
Workflow entity
You may create a new workflow by passing a hash of data to the Workflow constructor and invoking the create
method. Some internal fields (like id
) will be injected back in to the object after it is created.
data = {title: 'Test Workflow', external_id: 'abc123'}
workflow = Manifestly::Entity::Workflow.new(data)
workflow.create
If you specify an external_id
for a local reference, Manifest.ly will use an upsert
methodology (if the workflow does not exist it will be created - otherwise it will be updated). This effectively means that create/update/save function identically for workflows.
data = {title: 'Test Workflow Upsert', external_id: 'def456'}
workflow = Manifestly::Entity::Workflow.new(data).create
workflow.title = "#{workflow.title} (updated)"
workflow.create
You may delete a workflow if you specified an external_id when creating it.
data = {title: 'Test Workflow Delete', external_id: 'ghi789'}
workflow = Manifestly::Entity::Workflow.new(data).create
workflow.delete
Workflow Steps entity
Steps may be passed in when creating a workflow via the steps field.
data = {title: 'Test Workflow with steps', external_id: 'jkl012', steps: [{title: 'Step One'}]}
workflow = Manifestly::Entity::Workflow.new(data)
workflow.create
Checklist Run entity
You may start a new checklist run by passing a hash of data to the ChecklistRun constructor and invoking the create
method. You must include the internal id of an existing workflow as the checklist_id. Subsequent modifications of this checklist run or it's steps is only possible if you are listed as one of the users on the run.
my_email_address = 'john.smith@foo.bar'
my_user = Manifestly::Entity::User.list.find { |it| it.email == my_email_address }
data = {title: 'Test Workflow for checklist run', external_id: 'mno345', steps: [{title: 'Step One'}]}
workflow = Manifestly::Entity::Workflow.new(data).create
data = {title: 'Test Run', checklist_id: workflow.id, users: [my_user.id]}
checklist_run = Manifestly::Entity::ChecklistRun.new(data).create
You may complete a checklist step by calling the corresponding method on the step object. Currently you must either be a participant on the run or assigned to the step in order to complete it.
my_email_address = 'john.smith@foo.bar'
my_user = Manifestly::Entity::User.list.find { |it| it.email == my_email_address }
data = {title: 'Test Workflow for checklist run step complete', external_id: 'pqr678', steps: [{title: 'Step One'}]}
workflow = Manifestly::Entity::Workflow.new(data).create
data = {title: 'Test Run step complete', checklist_id: workflow.id, users: [my_user.id]}
checklist_run = Manifestly::Entity::ChecklistRun.new(data).create
checklist_run.steps.first.assign(my_user.id)
checklist_run.steps.first.complete
Supported Ruby Versions
This library is currently supported on Ruby 2.4+.
Versioning
This library follows Semantic Versioning.
Contributing
Contributions to this library are always welcome and highly encouraged.
See Contributing for more information on how to get started.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See Code of Conduct for more information.
License
This library is licensed under Apache 2.0. Full license text is available in LICENSE.
Support
Please report bugs at the project on Github
See Contributing for more information on how to get started.