Class: Retab::WorkflowEdges
- Inherits:
-
Object
- Object
- Retab::WorkflowEdges
- Defined in:
- lib/retab/workflow_edges.rb
Instance Method Summary collapse
-
#create(workflow_id:, source_block:, target_block:, id: nil, source_handle: nil, target_handle: nil, request_options: {}) ⇒ Retab::WorkflowEdgeDoc
Create Edge.
-
#delete(edge_id:, request_options: {}) ⇒ void
Delete Edge.
-
#get(edge_id:, request_options: {}) ⇒ Retab::WorkflowEdgeDoc
Get Edge.
-
#initialize(client) ⇒ WorkflowEdges
constructor
A new instance of WorkflowEdges.
-
#list(workflow_id:, source_block: nil, target_block: nil, before: nil, after: nil, limit: 100, request_options: {}) ⇒ Retab::Types::ListStruct<Retab::WorkflowEdgeDoc>
List Edges.
Constructor Details
#initialize(client) ⇒ WorkflowEdges
Returns a new instance of WorkflowEdges.
9 10 11 |
# File 'lib/retab/workflow_edges.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#create(workflow_id:, source_block:, target_block:, id: nil, source_handle: nil, target_handle: nil, request_options: {}) ⇒ Retab::WorkflowEdgeDoc
Create Edge
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 |
# File 'lib/retab/workflow_edges.rb', line 74 def create( workflow_id:, source_block:, target_block:, id: nil, source_handle: nil, target_handle: nil, request_options: {} ) body = { 'workflow_id' => workflow_id, 'id' => id, 'source_block' => source_block, 'target_block' => target_block, 'source_handle' => source_handle, 'target_handle' => target_handle }.compact response = @client.request( method: :post, path: '/v1/workflows/edges', auth: true, body: body, request_options: ) result = Retab::WorkflowEdgeDoc.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(edge_id:, request_options: {}) ⇒ void
This method returns an undefined value.
Delete Edge
126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/retab/workflow_edges.rb', line 126 def delete( edge_id:, request_options: {} ) response = @client.request( method: :delete, path: "/v1/workflows/edges/#{Retab::Util.encode_path(edge_id)}", auth: true, request_options: ) nil end |
#get(edge_id:, request_options: {}) ⇒ Retab::WorkflowEdgeDoc
Get Edge
107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/retab/workflow_edges.rb', line 107 def get( edge_id:, request_options: {} ) response = @client.request( method: :get, path: "/v1/workflows/edges/#{Retab::Util.encode_path(edge_id)}", auth: true, request_options: ) result = Retab::WorkflowEdgeDoc.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:, source_block: nil, target_block: nil, before: nil, after: nil, limit: 100, request_options: {}) ⇒ Retab::Types::ListStruct<Retab::WorkflowEdgeDoc>
List Edges
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 56 57 58 59 60 61 62 63 |
# File 'lib/retab/workflow_edges.rb', line 22 def list( workflow_id:, source_block: nil, target_block: nil, before: nil, after: nil, limit: 100, request_options: {} ) params = { 'workflow_id' => workflow_id, 'source_block' => source_block, 'target_block' => target_block, 'before' => before, 'after' => after, 'limit' => limit }.compact response = @client.request( method: :get, path: '/v1/workflows/edges', auth: true, params: params, request_options: ) fetch_next = ->(cursor) { list( workflow_id: workflow_id, source_block: source_block, target_block: target_block, before: before, after: cursor, limit: limit, request_options: ) } Retab::Types::ListStruct.from_response( response, model: Retab::WorkflowEdgeDoc, filters: { workflow_id: workflow_id, source_block: source_block, target_block: target_block, before: before, limit: limit }, fetch_next: fetch_next ) end |