README.md in dor-workflow-client-7.3.0 vs README.md in dor-workflow-client-7.4.0

- old
+ new

@@ -17,24 +17,74 @@ client = Dor::Workflow::Client.new(url: 'https://test-server.edu/workflow/') ``` Consumers of recent versions of the [dor-services](https://github.com/sul-dlss/dor-services) gem can access the configured `Dor::Workflow::Client` object via `Dor::Config`. +## Console + +During development, you can test the gem locally on your laptop, hitting a local instance of workflow-server-rails via the console: + +```ruby +bin/console + +client = Dor::Workflow::Client.new(url: 'http://localhost:3000') +client.create_workflow_by_name('druid:bc123df4567', 'accessionWF', version: '1', context: { 'requireOCR' => true}) + +client.workflows('druid:bc123df4567') + => ["accessionWF"] + +client.workflow(pid: 'druid:bc123df4567', workflow_name: 'accessionWF') +=> #<Dor::Workflow::Response::Workflow:0x0000000105c8b440 + +client.process(pid: 'druid:bc123df4567', workflow_name: 'accessionWF', process: 'start-accession').context + => {"requireOCR"=>true} + +client.all_workflows(pid: 'druid:bc123df4567') +=> #<Dor::Workflow::Response::Workflows:0x00000001055d29a0>..... +``` + ## API [Rubydoc](https://www.rubydoc.info/github/sul-dlss/dor-workflow-client/main) +### Workflow Variables + +If a workflow or workflows for a particular object require data to be persisted and available between steps, workflow variables can be set. These are per object/version pair and thus available to any step in any workflow for a given version of an object once set. Pass in a context variable as a Hash as shown in the example below. The context will be returned as a hash when fetching workflows data for an object. + ### Example usage Create a workflow ``` client.create_workflow_by_name('druid:bc123df4567', 'etdSubmitWF', version: '1') ``` +Create a workflow and send in context +``` +client.create_workflow_by_name('druid:bc123df4567', 'etdSubmitWF', version: '1', context: { foo: 'bar'} ) +``` + Update a workflow step's status ```ruby client.update_status(druid: 'druid:bc123df4567', workflow: 'etdSubmitWF', process: 'registrar-approval', status: 'completed') +``` + +Fetch information about a workflow: +```ruby +client.workflow(pid: 'druid:bc123df4567', workflow_name: 'etdSubmitWF') + => #<Dor::Workflow::Response::Workflow:0x000000010cb28588 +``` + +Fetch information about a workflow step: +```ruby +client.process(pid: 'druid:bc123df4567', workflow_name: 'etdSubmitWF', process: 'registrar-approval') + => #<Dor::Workflow::Response::Process:0x000000010c505098 +``` + +Fetch version context about a workflow step: +```ruby +client.process(pid: 'druid:bc123df4567', workflow_name: 'etdSubmitWF', process: 'registrar-approval').context + => {"foo"=>"bar"} ``` Show "milestones" for an object ```ruby client.milestones(druid: 'druid:gv054hp4128')