Class: Ittybit::AsyncAutomationsClient
- Inherits:
-
Object
- Object
- Ittybit::AsyncAutomationsClient
- Defined in:
- lib/ittybit/automations/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(trigger:, workflow:, name: nil, description: nil, status: nil, request_options: nil) ⇒ Ittybit::Automations::AutomationsCreateResponse
Creates a new automation.
-
#delete(id:, request_options: nil) ⇒ Ittybit::Automations::AutomationsDeleteResponse
Permanently removes an automation from the system.
-
#get(id:, request_options: nil) ⇒ Ittybit::Automations::AutomationsGetResponse
Retrieve the automation object for a automation with the given ID.
- #initialize(request_client:) ⇒ Ittybit::AsyncAutomationsClient constructor
-
#list(page: nil, limit: nil, request_options: nil) ⇒ Array<Ittybit::Automations::AutomationsListResponseItem>
Retrieves a paginated list of all automations for the current project.
-
#update(id:, name: nil, description: nil, trigger: nil, workflow: nil, status: nil, request_options: nil) ⇒ Ittybit::Automations::AutomationsUpdateResponse
Updates an automation’s ‘name`, `description`, `trigger`, `workflow`, or `status`.
Constructor Details
#initialize(request_client:) ⇒ Ittybit::AsyncAutomationsClient
249 250 251 |
# File 'lib/ittybit/automations/client.rb', line 249 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Ittybit::AsyncRequestClient (readonly)
245 246 247 |
# File 'lib/ittybit/automations/client.rb', line 245 def request_client @request_client end |
Instance Method Details
#create(trigger:, workflow:, name: nil, description: nil, status: nil, request_options: nil) ⇒ Ittybit::Automations::AutomationsCreateResponse
Creates a new automation.
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/ittybit/automations/client.rb', line 319 def create(trigger:, workflow:, name: nil, description: nil, status: nil, request_options: nil) Async do response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .api_key unless &.api_key.nil? req.headers["ACCEPT_VERSION"] = .version unless &.version.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), name: name, description: description, trigger: trigger, workflow: workflow, status: status }.compact req.url "#{@request_client.get_url(request_options: )}/automations" end Ittybit::Automations::AutomationsCreateResponse.from_json(json_object: response.body) end end |
#delete(id:, request_options: nil) ⇒ Ittybit::Automations::AutomationsDeleteResponse
Permanently removes an automation from the system. This action cannot be undone.
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
# File 'lib/ittybit/automations/client.rb', line 395 def delete(id:, request_options: nil) Async do response = @request_client.conn.delete do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .api_key unless &.api_key.nil? req.headers["ACCEPT_VERSION"] = .version unless &.version.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}), "Accept-Version": "2025-08-20" }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/automations/#{id}" end Ittybit::Automations::AutomationsDeleteResponse.from_json(json_object: response.body) end end |
#get(id:, request_options: nil) ⇒ Ittybit::Automations::AutomationsGetResponse
Retrieve the automation object for a automation with the given ID.
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/ittybit/automations/client.rb', line 359 def get(id:, request_options: nil) Async do response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .api_key unless &.api_key.nil? req.headers["ACCEPT_VERSION"] = .version unless &.version.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}), "Accept-Version": "2025-08-20" }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/automations/#{id}" end Ittybit::Automations::AutomationsGetResponse.from_json(json_object: response.body) end end |
#list(page: nil, limit: nil, request_options: nil) ⇒ Array<Ittybit::Automations::AutomationsListResponseItem>
Retrieves a paginated list of all automations for the current project.
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/ittybit/automations/client.rb', line 266 def list(page: nil, limit: nil, request_options: nil) Async do response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .api_key unless &.api_key.nil? req.headers["ACCEPT_VERSION"] = .version unless &.version.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}), "Accept-Version": "2025-08-20" }.compact req.params = { **(&.additional_query_parameters || {}), "page": page, "limit": limit }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/automations" end parsed_json = JSON.parse(response.body) parsed_json&.map do |item| item = item.to_json Ittybit::Automations::AutomationsListResponseItem.from_json(json_object: item) end end end |
#update(id:, name: nil, description: nil, trigger: nil, workflow: nil, status: nil, request_options: nil) ⇒ Ittybit::Automations::AutomationsUpdateResponse
Updates an automation’s ‘name`, `description`, `trigger`, `workflow`, or
`status`. Only the specified fields will be updated.
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/ittybit/automations/client.rb', line 447 def update(id:, name: nil, description: nil, trigger: nil, workflow: nil, status: nil, request_options: nil) Async do response = @request_client.conn.patch do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .api_key unless &.api_key.nil? req.headers["ACCEPT_VERSION"] = .version unless &.version.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}), "Accept-Version": "2025-08-20" }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), name: name, description: description, trigger: trigger, workflow: workflow, status: status }.compact req.url "#{@request_client.get_url(request_options: )}/automations/#{id}" end Ittybit::Automations::AutomationsUpdateResponse.from_json(json_object: response.body) end end |