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.
- #executions ⇒ Object
-
#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::PaginatedList<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
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 |
#delete(block_id:, workflow_id: nil, request_options: {}) ⇒ void
This method returns an undefined value.
Delete Block
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/retab/workflow_blocks.rb', line 205 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
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/retab/workflow_blocks.rb', line 120 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::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 |
#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
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 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/retab/workflow_blocks.rb', line 157 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 |