Class: Retab::WorkflowBlocks
- Inherits:
-
Object
- Object
- Retab::WorkflowBlocks
- Defined in:
- lib/retab/workflow_blocks.rb
Instance Method Summary collapse
-
#create(workflow_id:, type:, id: nil, label: nil, position_x: nil, position_y: nil, width: nil, height: nil, config: nil, parent_id: nil, request_options: {}) ⇒ Retab::WorkflowBlock
Create Block.
-
#create_block_validate_config(block_id:, config:, config_mode: nil, workflow_id: nil, request_options: {}) ⇒ Retab::ValidateWorkflowBlockConfigResponse
Validate Block Config.
-
#create_version_restore(block_version_id:, request_options: {}) ⇒ Retab::WorkflowBlock
Restore Block Version.
-
#delete(block_id:, workflow_id: nil, request_options: {}) ⇒ void
Delete Block.
- #executions ⇒ Object
-
#get(block_id:, workflow_id: nil, request_options: {}) ⇒ Retab::WorkflowBlock
Get Block.
-
#get_version(block_version_id:, request_options: {}) ⇒ Retab::WorkflowBlockVersion
Get Block Version.
-
#initialize(client) ⇒ WorkflowBlocks
constructor
A new instance of WorkflowBlocks.
-
#list(workflow_id:, before: nil, after: nil, limit: 100, request_options: {}) ⇒ Retab::PaginatedList<Retab::WorkflowBlock>
List Blocks.
-
#list_diff(from_block_version_id:, to_block_version_id:, request_options: {}) ⇒ Retab::WorkflowBlockVersionDiff
Diff Block Versions.
-
#list_versions(workflow_id:, block_id: nil, workflow_version_id: nil, before: nil, after: nil, limit: 50, request_options: {}) ⇒ Retab::PaginatedList<Retab::WorkflowBlockVersion>
List Block Versions.
-
#update(block_id:, label: nil, position_x: nil, position_y: nil, width: nil, height: nil, config: nil, parent_id: nil, config_mode: nil, workflow_id: nil, request_options: {}) ⇒ Retab::WorkflowBlock
Update Block.
Constructor Details
#initialize(client) ⇒ WorkflowBlocks
Returns a new instance of WorkflowBlocks.
9 10 11 |
# File 'lib/retab/workflow_blocks.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#create(workflow_id:, type:, id: nil, label: nil, position_x: nil, position_y: nil, width: nil, height: nil, config: nil, parent_id: nil, request_options: {}) ⇒ Retab::WorkflowBlock
Create Block
74 75 76 77 78 79 80 81 82 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 |
# File 'lib/retab/workflow_blocks.rb', line 74 def create( workflow_id:, type:, id: nil, label: nil, position_x: nil, position_y: nil, width: nil, height: nil, config: nil, parent_id: nil, request_options: {} ) body = { "workflow_id" => workflow_id, "id" => id, "type" => type, "label" => label, "position_x" => position_x, "position_y" => position_y, "width" => width, "height" => height, "config" => config, "parent_id" => parent_id }.compact response = @client.request( method: :post, path: "/v1/workflows/blocks", auth: true, body: body, request_options: ) result = Retab::WorkflowBlock.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 |
#create_block_validate_config(block_id:, config:, config_mode: nil, workflow_id: nil, request_options: {}) ⇒ Retab::ValidateWorkflowBlockConfigResponse
Validate Block Config
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/retab/workflow_blocks.rb', line 364 def create_block_validate_config( block_id:, config:, config_mode: nil, workflow_id: nil, request_options: {} ) params = { "workflow_id" => workflow_id }.compact body = { "config" => config, "config_mode" => config_mode }.compact response = @client.request( method: :post, path: "/v1/workflows/blocks/#{Retab::Util.encode_path(block_id)}/validate-config", auth: true, params: params, body: body, request_options: ) result = Retab::ValidateWorkflowBlockConfigResponse.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 |
#create_version_restore(block_version_id:, request_options: {}) ⇒ Retab::WorkflowBlock
Restore Block Version
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/retab/workflow_blocks.rb', line 230 def create_version_restore( block_version_id:, request_options: {} ) response = @client.request( method: :post, path: "/v1/workflows/blocks/versions/#{Retab::Util.encode_path(block_version_id)}/restore", auth: true, request_options: ) result = Retab::WorkflowBlock.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(block_id:, workflow_id: nil, request_options: {}) ⇒ void
This method returns an undefined value.
Delete Block
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/retab/workflow_blocks.rb', line 339 def delete( block_id:, workflow_id: nil, request_options: {} ) params = { "workflow_id" => workflow_id }.compact @client.request( method: :delete, path: "/v1/workflows/blocks/#{Retab::Util.encode_path(block_id)}", auth: true, params: params, request_options: ) nil end |
#executions ⇒ Object
13 14 15 |
# File 'lib/retab/workflow_blocks.rb', line 13 def executions @executions ||= Retab::WorkflowBlockExecutions.new(@client) end |
#get(block_id:, workflow_id: nil, request_options: {}) ⇒ Retab::WorkflowBlock
Get Block
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/retab/workflow_blocks.rb', line 254 def get( block_id:, workflow_id: nil, request_options: {} ) params = { "workflow_id" => workflow_id }.compact response = @client.request( method: :get, path: "/v1/workflows/blocks/#{Retab::Util.encode_path(block_id)}", auth: true, params: params, request_options: ) result = Retab::WorkflowBlock.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 |
#get_version(block_version_id:, request_options: {}) ⇒ Retab::WorkflowBlockVersion
Get Block Version
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/retab/workflow_blocks.rb', line 207 def get_version( block_version_id:, request_options: {} ) response = @client.request( method: :get, path: "/v1/workflows/blocks/versions/#{Retab::Util.encode_path(block_version_id)}", auth: true, request_options: ) result = Retab::WorkflowBlockVersion.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: 100, request_options: {}) ⇒ Retab::PaginatedList<Retab::WorkflowBlock>
List Blocks
24 25 26 27 28 29 30 31 32 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 |
# File 'lib/retab/workflow_blocks.rb', line 24 def list( workflow_id:, before: nil, after: nil, limit: 100, request_options: {} ) params = { "workflow_id" => workflow_id, "before" => before, "after" => after, "limit" => limit }.compact response = @client.request( method: :get, path: "/v1/workflows/blocks", auth: true, params: params, request_options: ) fetch_next = -> (cursor) { list( workflow_id: workflow_id, before: before, after: cursor, limit: limit, request_options: ) } Retab::PaginatedList.from_response( response, model: Retab::WorkflowBlock, filters: {workflow_id: workflow_id, before: before, limit: limit}, fetch_next: fetch_next ) end |
#list_diff(from_block_version_id:, to_block_version_id:, request_options: {}) ⇒ Retab::WorkflowBlockVersionDiff
Diff Block Versions
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/retab/workflow_blocks.rb', line 178 def list_diff( from_block_version_id:, to_block_version_id:, request_options: {} ) params = { "from_block_version_id" => from_block_version_id, "to_block_version_id" => to_block_version_id } response = @client.request( method: :get, path: "/v1/workflows/blocks/versions/diff", auth: true, params: params, request_options: ) result = Retab::WorkflowBlockVersionDiff.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_versions(workflow_id:, block_id: nil, workflow_version_id: nil, before: nil, after: nil, limit: 50, request_options: {}) ⇒ Retab::PaginatedList<Retab::WorkflowBlockVersion>
List Block Versions
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/retab/workflow_blocks.rb', line 124 def list_versions( workflow_id:, block_id: nil, workflow_version_id: nil, before: nil, after: nil, limit: 50, request_options: {} ) params = { "workflow_id" => workflow_id, "block_id" => block_id, "workflow_version_id" => workflow_version_id, "before" => before, "after" => after, "limit" => limit }.compact response = @client.request( method: :get, path: "/v1/workflows/blocks/versions", auth: true, params: params, request_options: ) fetch_next = -> (cursor) { list_versions( workflow_id: workflow_id, block_id: block_id, workflow_version_id: workflow_version_id, before: before, after: cursor, limit: limit, request_options: ) } Retab::PaginatedList.from_response( response, model: Retab::WorkflowBlockVersion, filters: { workflow_id: workflow_id, block_id: block_id, workflow_version_id: workflow_version_id, before: before, limit: limit }, fetch_next: fetch_next ) end |
#update(block_id:, label: nil, position_x: nil, position_y: nil, width: nil, height: nil, config: nil, parent_id: nil, config_mode: nil, workflow_id: nil, request_options: {}) ⇒ Retab::WorkflowBlock
Update Block
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/retab/workflow_blocks.rb', line 291 def update( block_id:, label: nil, position_x: nil, position_y: nil, width: nil, height: nil, config: nil, parent_id: nil, config_mode: nil, workflow_id: nil, request_options: {} ) params = { "workflow_id" => workflow_id }.compact body = { "label" => label, "position_x" => position_x, "position_y" => position_y, "width" => width, "height" => height, "config" => config, "parent_id" => parent_id, "config_mode" => config_mode }.compact response = @client.request( method: :patch, path: "/v1/workflows/blocks/#{Retab::Util.encode_path(block_id)}", auth: true, params: params, body: body, request_options: ) result = Retab::WorkflowBlock.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 |