Class: Retab::WorkflowExperiments
- Inherits:
-
Object
- Object
- Retab::WorkflowExperiments
- Defined in:
- lib/retab/workflow_experiments.rb
Instance Method Summary collapse
-
#create(workflow_id:, block_id: nil, document_captures: nil, documents: nil, n_consensus: nil, name: nil, source_experiment_id: nil, request_options: {}) ⇒ Retab::WorkflowExperiment
Create Experiment.
-
#delete(experiment_id:, request_options: {}) ⇒ void
Delete Experiment.
-
#get(experiment_id:, request_options: {}) ⇒ Retab::WorkflowExperiment
Get Experiment.
-
#initialize(client) ⇒ WorkflowExperiments
constructor
A new instance of WorkflowExperiments.
-
#list(workflow_id:, request_options: {}) ⇒ Retab::Types::ListStruct<Retab::WorkflowExperiment>
List Experiments.
-
#update(experiment_id:, document_captures: nil, documents: nil, n_consensus: nil, name: nil, request_options: {}) ⇒ Retab::WorkflowExperiment
Update Experiment.
Constructor Details
#initialize(client) ⇒ WorkflowExperiments
Returns a new instance of WorkflowExperiments.
9 10 11 |
# File 'lib/retab/workflow_experiments.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#create(workflow_id:, block_id: nil, document_captures: nil, documents: nil, n_consensus: nil, name: nil, source_experiment_id: nil, request_options: {}) ⇒ Retab::WorkflowExperiment
Create Experiment
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/retab/workflow_experiments.rb', line 48 def create( workflow_id:, block_id: nil, document_captures: nil, documents: nil, n_consensus: nil, name: nil, source_experiment_id: nil, request_options: {} ) body = { 'workflow_id' => workflow_id, 'block_id' => block_id, 'document_captures' => document_captures, 'documents' => documents, 'n_consensus' => n_consensus, 'name' => name, 'source_experiment_id' => source_experiment_id }.compact response = @client.request( method: :post, path: '/v1/workflows/experiments', auth: true, body: body, request_options: ) result = Retab::WorkflowExperiment.new(response.body) result.last_response = Retab::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#delete(experiment_id:, request_options: {}) ⇒ void
This method returns an undefined value.
Delete Experiment
136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/retab/workflow_experiments.rb', line 136 def delete( experiment_id:, request_options: {} ) response = @client.request( method: :delete, path: "/v1/workflows/experiments/#{Retab::Util.encode_path(experiment_id)}", auth: true, request_options: ) nil end |
#get(experiment_id:, request_options: {}) ⇒ Retab::WorkflowExperiment
Get Experiment
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/retab/workflow_experiments.rb', line 83 def get( experiment_id:, request_options: {} ) response = @client.request( method: :get, path: "/v1/workflows/experiments/#{Retab::Util.encode_path(experiment_id)}", auth: true, request_options: ) result = Retab::WorkflowExperiment.new(response.body) result.last_response = Retab::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#list(workflow_id:, request_options: {}) ⇒ Retab::Types::ListStruct<Retab::WorkflowExperiment>
List Experiments
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/retab/workflow_experiments.rb', line 17 def list( workflow_id:, request_options: {} ) params = { 'workflow_id' => workflow_id } response = @client.request( method: :get, path: '/v1/workflows/experiments', auth: true, params: params, request_options: ) Retab::Types::ListStruct.from_response( response, model: Retab::WorkflowExperiment, filters: { workflow_id: workflow_id } ) end |
#update(experiment_id:, document_captures: nil, documents: nil, n_consensus: nil, name: nil, request_options: {}) ⇒ Retab::WorkflowExperiment
Update Experiment
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/retab/workflow_experiments.rb', line 106 def update( experiment_id:, document_captures: nil, documents: nil, n_consensus: nil, name: nil, request_options: {} ) body = { 'document_captures' => document_captures, 'documents' => documents, 'n_consensus' => n_consensus, 'name' => name }.compact response = @client.request( method: :patch, path: "/v1/workflows/experiments/#{Retab::Util.encode_path(experiment_id)}", auth: true, body: body, request_options: ) result = Retab::WorkflowExperiment.new(response.body) result.last_response = Retab::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |