Class: Retab::Workflows
- Inherits:
-
Object
- Object
- Retab::Workflows
- Defined in:
- lib/retab/workflows.rb
Instance Method Summary collapse
- #artifacts ⇒ Object
- #blocks ⇒ Object
-
#create(name: nil, description: nil, request_options: {}) ⇒ Retab::Workflow
Create Workflow.
-
#delete(workflow_id:, request_options: {}) ⇒ void
Delete Workflow.
- #edges ⇒ Object
- #experiments ⇒ Object
-
#get(workflow_id:, request_options: {}) ⇒ Retab::Workflow
Get Workflow.
-
#initialize(client) ⇒ Workflows
constructor
A new instance of Workflows.
-
#list(before: nil, after: nil, limit: 10, order: "desc", sort_by: "updated_at", request_options: {}) ⇒ Retab::PaginatedList<Retab::Workflow>
List Workflows.
-
#publish(workflow_id:, description: nil, request_options: {}) ⇒ Retab::Workflow
Publish Workflow.
- #reviews ⇒ Object
- #runs ⇒ Object
- #spec ⇒ Object
- #steps ⇒ Object
- #tests ⇒ Object
-
#update(workflow_id:, name: nil, description: nil, request_options: {}) ⇒ Retab::Workflow
Update Workflow.
Constructor Details
#initialize(client) ⇒ Workflows
Returns a new instance of Workflows.
9 10 11 |
# File 'lib/retab/workflows.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#artifacts ⇒ Object
13 14 15 |
# File 'lib/retab/workflows.rb', line 13 def artifacts @artifacts ||= Retab::WorkflowArtifacts.new(@client) end |
#blocks ⇒ Object
17 18 19 |
# File 'lib/retab/workflows.rb', line 17 def blocks @blocks ||= Retab::WorkflowBlocks.new(@client) end |
#create(name: nil, description: nil, request_options: {}) ⇒ Retab::Workflow
Create Workflow
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/retab/workflows.rb', line 102 def create( name: nil, description: nil, request_options: {} ) body = { "name" => name, "description" => description }.compact response = @client.request( method: :post, path: "/v1/workflows", auth: true, body: body, request_options: ) result = Retab::Workflow.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(workflow_id:, request_options: {}) ⇒ void
This method returns an undefined value.
Delete Workflow
186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/retab/workflows.rb', line 186 def delete( workflow_id:, request_options: {} ) @client.request( method: :delete, path: "/v1/workflows/#{Retab::Util.encode_path(workflow_id)}", auth: true, request_options: ) nil end |
#edges ⇒ Object
21 22 23 |
# File 'lib/retab/workflows.rb', line 21 def edges @edges ||= Retab::WorkflowEdges.new(@client) end |
#experiments ⇒ Object
25 26 27 |
# File 'lib/retab/workflows.rb', line 25 def experiments @experiments ||= Retab::WorkflowExperiments.new(@client) end |
#get(workflow_id:, request_options: {}) ⇒ Retab::Workflow
Get Workflow
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/retab/workflows.rb', line 131 def get( workflow_id:, request_options: {} ) response = @client.request( method: :get, path: "/v1/workflows/#{Retab::Util.encode_path(workflow_id)}", auth: true, request_options: ) result = Retab::Workflow.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(before: nil, after: nil, limit: 10, order: "desc", sort_by: "updated_at", request_options: {}) ⇒ Retab::PaginatedList<Retab::Workflow>
List Workflows
57 58 59 60 61 62 63 64 65 66 67 68 69 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 |
# File 'lib/retab/workflows.rb', line 57 def list( before: nil, after: nil, limit: 10, order: "desc", sort_by: "updated_at", request_options: {} ) params = { "before" => before, "after" => after, "limit" => limit, "order" => order, "sort_by" => sort_by }.compact response = @client.request( method: :get, path: "/v1/workflows", auth: true, params: params, request_options: ) fetch_next = -> (cursor) { list( before: before, after: cursor, limit: limit, order: order, sort_by: sort_by, request_options: ) } Retab::PaginatedList.from_response( response, model: Retab::Workflow, filters: {before: before, limit: limit, order: order, sort_by: sort_by}, fetch_next: fetch_next ) end |
#publish(workflow_id:, description: nil, request_options: {}) ⇒ Retab::Workflow
Publish Workflow
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/retab/workflows.rb', line 204 def publish( workflow_id:, description: nil, request_options: {} ) body = { "description" => description }.compact response = @client.request( method: :post, path: "/v1/workflows/#{Retab::Util.encode_path(workflow_id)}/publish", auth: true, body: body, request_options: ) result = Retab::Workflow.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 |
#reviews ⇒ Object
29 30 31 |
# File 'lib/retab/workflows.rb', line 29 def reviews @reviews ||= Retab::WorkflowReviews.new(@client) end |
#runs ⇒ Object
33 34 35 |
# File 'lib/retab/workflows.rb', line 33 def runs @runs ||= Retab::WorkflowRuns.new(@client) end |
#spec ⇒ Object
37 38 39 |
# File 'lib/retab/workflows.rb', line 37 def spec @spec ||= Retab::WorkflowSpec.new(@client) end |
#steps ⇒ Object
41 42 43 |
# File 'lib/retab/workflows.rb', line 41 def steps @steps ||= Retab::WorkflowSteps.new(@client) end |
#tests ⇒ Object
45 46 47 |
# File 'lib/retab/workflows.rb', line 45 def tests @tests ||= Retab::WorkflowTests.new(@client) end |
#update(workflow_id:, name: nil, description: nil, request_options: {}) ⇒ Retab::Workflow
Update Workflow
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 |
# File 'lib/retab/workflows.rb', line 156 def update( workflow_id:, name: nil, description: nil, request_options: {} ) body = { "name" => name, "description" => description }.compact response = @client.request( method: :patch, path: "/v1/workflows/#{Retab::Util.encode_path(workflow_id)}", auth: true, body: body, request_options: ) result = Retab::Workflow.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 |