Class: Ittybit::AutomationsClient
- Inherits:
-
Object
- Object
- Ittybit::AutomationsClient
- 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::AutomationsClient 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::AutomationsClient
25 26 27 |
# File 'lib/ittybit/automations/client.rb', line 25 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Ittybit::RequestClient (readonly)
21 22 23 |
# File 'lib/ittybit/automations/client.rb', line 21 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.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/ittybit/automations/client.rb', line 93 def create(trigger:, workflow:, name: nil, description: nil, status: nil, request_options: nil) 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 |
#delete(id:, request_options: nil) ⇒ Ittybit::Automations::AutomationsDeleteResponse
Permanently removes an automation from the system. This action cannot be undone.
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/ittybit/automations/client.rb', line 165 def delete(id:, request_options: nil) 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 |
#get(id:, request_options: nil) ⇒ Ittybit::Automations::AutomationsGetResponse
Retrieve the automation object for a automation with the given ID.
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/ittybit/automations/client.rb', line 131 def get(id:, request_options: nil) 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 |
#list(page: nil, limit: nil, request_options: nil) ⇒ Array<Ittybit::Automations::AutomationsListResponseItem>
Retrieves a paginated list of all automations for the current project.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ittybit/automations/client.rb', line 42 def list(page: nil, limit: nil, request_options: nil) 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 |
#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.
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/ittybit/automations/client.rb', line 215 def update(id:, name: nil, description: nil, trigger: nil, workflow: nil, status: nil, request_options: nil) 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 |