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.
-
#delete(block_id:, workflow_id: nil, request_options: {}) ⇒ void
Delete Block.
-
#get(block_id:, workflow_id: nil, request_options: {}) ⇒ Retab::WorkflowBlock
Get Block.
-
#initialize(client) ⇒ WorkflowBlocks
constructor
A new instance of WorkflowBlocks.
-
#list(workflow_id:, before: nil, after: nil, limit: 100, request_options: {}) ⇒ Retab::Types::ListStruct<Retab::WorkflowBlock>
List Blocks.
-
#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
70 71 72 73 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 |
# File 'lib/retab/workflow_blocks.rb', line 70 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 |
#delete(block_id:, workflow_id: nil, request_options: {}) ⇒ void
This method returns an undefined value.
Delete Block
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/retab/workflow_blocks.rb', line 189 def delete( block_id:, workflow_id: nil, request_options: {} ) params = { 'workflow_id' => workflow_id }.compact response = @client.request( method: :delete, path: "/v1/workflows/blocks/#{Retab::Util.encode_path(block_id)}", auth: true, params: params, request_options: ) nil end |
#get(block_id:, workflow_id: nil, request_options: {}) ⇒ Retab::WorkflowBlock
Get Block
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/retab/workflow_blocks.rb', line 112 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 |
#list(workflow_id:, before: nil, after: nil, limit: 100, request_options: {}) ⇒ Retab::Types::ListStruct<Retab::WorkflowBlock>
List Blocks
20 21 22 23 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 |
# File 'lib/retab/workflow_blocks.rb', line 20 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::Types::ListStruct.from_response( response, model: Retab::WorkflowBlock, filters: { workflow_id: workflow_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
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 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/retab/workflow_blocks.rb', line 145 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 |