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:, before: nil, after: nil, limit: 50, order: "desc", request_options: {}) ⇒ Retab::PaginatedList<Retab::WorkflowExperiment>
List Experiments.
- #metrics ⇒ Object
- #results ⇒ Object
- #runs ⇒ Object
-
#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
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/retab/workflow_experiments.rb', line 83 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
183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/retab/workflow_experiments.rb', line 183 def delete( experiment_id:, request_options: {} ) @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
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/retab/workflow_experiments.rb', line 122 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:, before: nil, after: nil, limit: 50, order: "desc", request_options: {}) ⇒ Retab::PaginatedList<Retab::WorkflowExperiment>
List Experiments
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/retab/workflow_experiments.rb', line 33 def list( workflow_id:, before: nil, after: nil, limit: 50, order: "desc", request_options: {} ) params = { "workflow_id" => workflow_id, "before" => before, "after" => after, "limit" => limit, "order" => order }.compact response = @client.request( method: :get, path: "/v1/workflows/experiments", auth: true, params: params, request_options: ) fetch_next = -> (cursor) { list( workflow_id: workflow_id, before: before, after: cursor, limit: limit, order: order, request_options: ) } Retab::PaginatedList.from_response( response, model: Retab::WorkflowExperiment, filters: {workflow_id: workflow_id, before: before, limit: limit, order: order}, fetch_next: fetch_next ) end |
#metrics ⇒ Object
13 14 15 |
# File 'lib/retab/workflow_experiments.rb', line 13 def metrics @metrics ||= Retab::ExperimentRunMetrics.new(@client) end |
#results ⇒ Object
17 18 19 |
# File 'lib/retab/workflow_experiments.rb', line 17 def results @results ||= Retab::ExperimentRunResults.new(@client) end |
#runs ⇒ Object
21 22 23 |
# File 'lib/retab/workflow_experiments.rb', line 21 def runs @runs ||= Retab::ExperimentRuns.new(@client) end |
#update(experiment_id:, document_captures: nil, documents: nil, n_consensus: nil, name: nil, request_options: {}) ⇒ Retab::WorkflowExperiment
Update Experiment
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/retab/workflow_experiments.rb', line 149 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 |