Class: ContextDev::Resources::Monitors
- Inherits:
-
Object
- Object
- ContextDev::Resources::Monitors
- Defined in:
- lib/context_dev/resources/monitors.rb,
sig/context_dev/resources/monitors.rbs
Overview
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. The change.detected webhook payload is documented by the MonitorsChangeDetectedWebhookPayload schema.
Instance Method Summary collapse
-
#create(change_detection:, name:, schedule:, target:, mode: nil, tags: nil, webhook: nil, request_options: {}) ⇒ ContextDev::Models::MonitorCreateResponse
Some parameter documentations has been truncated, see Models::MonitorCreateParams for more details.
-
#delete(monitor_id, request_options: {}) ⇒ ContextDev::Models::MonitorDeleteResponse
Delete a monitor.
-
#initialize(client:) ⇒ Monitors
constructor
private
A new instance of Monitors.
-
#list(change_detection_type: nil, cursor: nil, limit: nil, q: nil, search_by: nil, search_type: nil, status: nil, tag: nil, tags: nil, target_type: nil, request_options: {}) ⇒ ContextDev::Models::MonitorListResponse
Some parameter documentations has been truncated, see Models::MonitorListParams for more details.
-
#list_account_changes(change_detection_type: nil, cursor: nil, limit: nil, monitor_id: nil, since: nil, tag: nil, target_type: nil, until_: nil, request_options: {}) ⇒ ContextDev::Models::MonitorListAccountChangesResponse
Returns an account-wide feed of detected changes across monitors.
-
#list_account_runs(cursor: nil, limit: nil, status: nil, request_options: {}) ⇒ ContextDev::Models::MonitorListAccountRunsResponse
Some parameter documentations has been truncated, see Models::MonitorListAccountRunsParams for more details.
-
#list_changes(monitor_id, cursor: nil, limit: nil, since: nil, tag: nil, until_: nil, request_options: {}) ⇒ ContextDev::Models::MonitorListChangesResponse
List changes for a monitor.
-
#list_runs(monitor_id, cursor: nil, limit: nil, status: nil, request_options: {}) ⇒ ContextDev::Models::MonitorListRunsResponse
Some parameter documentations has been truncated, see Models::MonitorListRunsParams for more details.
-
#retrieve(monitor_id, request_options: {}) ⇒ ContextDev::Models::MonitorRetrieveResponse
Get a monitor.
-
#retrieve_change(change_id, request_options: {}) ⇒ ContextDev::Models::MonitorRetrieveChangeResponse
Get a change.
-
#run(monitor_id, request_options: {}) ⇒ ContextDev::Models::MonitorRunResponse
Triggers an immediate run of the monitor outside its normal schedule.
-
#update(monitor_id, change_detection: nil, name: nil, schedule: nil, status: nil, tags: nil, target: nil, webhook: nil, request_options: {}) ⇒ ContextDev::Models::MonitorUpdateResponse
Some parameter documentations has been truncated, see Models::MonitorUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Monitors
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Monitors.
347 348 349 |
# File 'lib/context_dev/resources/monitors.rb', line 347 def initialize(client:) @client = client end |
Instance Method Details
#create(change_detection:, name:, schedule:, target:, mode: nil, tags: nil, webhook: nil, request_options: {}) ⇒ ContextDev::Models::MonitorCreateResponse
Some parameter documentations has been truncated, see Models::MonitorCreateParams for more details.
Creates a monitor. The request body is a union of the supported target/change detection combinations. The monitor runs immediately after creation to create its initial baseline.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/context_dev/resources/monitors.rb', line 37 def create(params) parsed, = ContextDev::MonitorCreateParams.dump_request(params) @client.request( method: :post, path: "monitors", body: parsed, model: ContextDev::Models::MonitorCreateResponse, options: ) end |
#delete(monitor_id, request_options: {}) ⇒ ContextDev::Models::MonitorDeleteResponse
Delete a monitor
164 165 166 167 168 169 170 171 |
# File 'lib/context_dev/resources/monitors.rb', line 164 def delete(monitor_id, params = {}) @client.request( method: :delete, path: ["monitors/%1$s", monitor_id], model: ContextDev::Models::MonitorDeleteResponse, options: params[:request_options] ) end |
#list(change_detection_type: nil, cursor: nil, limit: nil, q: nil, search_by: nil, search_type: nil, status: nil, tag: nil, tags: nil, target_type: nil, request_options: {}) ⇒ ContextDev::Models::MonitorListResponse
Some parameter documentations has been truncated, see Models::MonitorListParams for more details.
Lists monitors for the authenticated organization. Supports free-text search
(q over search_by fields, prefix or exact via search_type) plus
status/type/tag filters. Results are paginated via the opaque cursor.
142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/context_dev/resources/monitors.rb', line 142 def list(params = {}) parsed, = ContextDev::MonitorListParams.dump_request(params) query = ContextDev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "monitors", query: query, model: ContextDev::Models::MonitorListResponse, options: ) end |
#list_account_changes(change_detection_type: nil, cursor: nil, limit: nil, monitor_id: nil, since: nil, tag: nil, target_type: nil, until_: nil, request_options: {}) ⇒ ContextDev::Models::MonitorListAccountChangesResponse
Returns an account-wide feed of detected changes across monitors.
198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/context_dev/resources/monitors.rb', line 198 def list_account_changes(params = {}) parsed, = ContextDev::MonitorListAccountChangesParams.dump_request(params) query = ContextDev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "monitors/changes", query: query.transform_keys(until_: "until"), model: ContextDev::Models::MonitorListAccountChangesResponse, options: ) end |
#list_account_runs(cursor: nil, limit: nil, status: nil, request_options: {}) ⇒ ContextDev::Models::MonitorListAccountRunsResponse
Some parameter documentations has been truncated, see Models::MonitorListAccountRunsParams for more details.
Returns an account-wide feed of monitor runs across all monitors.
228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/context_dev/resources/monitors.rb', line 228 def list_account_runs(params = {}) parsed, = ContextDev::MonitorListAccountRunsParams.dump_request(params) query = ContextDev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "monitors/runs", query: query, model: ContextDev::Models::MonitorListAccountRunsResponse, options: ) end |
#list_changes(monitor_id, cursor: nil, limit: nil, since: nil, tag: nil, until_: nil, request_options: {}) ⇒ ContextDev::Models::MonitorListChangesResponse
List changes for a monitor
261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/context_dev/resources/monitors.rb', line 261 def list_changes(monitor_id, params = {}) parsed, = ContextDev::MonitorListChangesParams.dump_request(params) query = ContextDev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["monitors/%1$s/changes", monitor_id], query: query.transform_keys(until_: "until"), model: ContextDev::Models::MonitorListChangesResponse, options: ) end |
#list_runs(monitor_id, cursor: nil, limit: nil, status: nil, request_options: {}) ⇒ ContextDev::Models::MonitorListRunsResponse
Some parameter documentations has been truncated, see Models::MonitorListRunsParams for more details.
List monitor runs
293 294 295 296 297 298 299 300 301 302 303 |
# File 'lib/context_dev/resources/monitors.rb', line 293 def list_runs(monitor_id, params = {}) parsed, = ContextDev::MonitorListRunsParams.dump_request(params) query = ContextDev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["monitors/%1$s/runs", monitor_id], query: query, model: ContextDev::Models::MonitorListRunsResponse, options: ) end |
#retrieve(monitor_id, request_options: {}) ⇒ ContextDev::Models::MonitorRetrieveResponse
Get a monitor
58 59 60 61 62 63 64 65 |
# File 'lib/context_dev/resources/monitors.rb', line 58 def retrieve(monitor_id, params = {}) @client.request( method: :get, path: ["monitors/%1$s", monitor_id], model: ContextDev::Models::MonitorRetrieveResponse, options: params[:request_options] ) end |
#retrieve_change(change_id, request_options: {}) ⇒ ContextDev::Models::MonitorRetrieveChangeResponse
Get a change
315 316 317 318 319 320 321 322 |
# File 'lib/context_dev/resources/monitors.rb', line 315 def retrieve_change(change_id, params = {}) @client.request( method: :get, path: ["monitors/changes/%1$s", change_id], model: ContextDev::Models::MonitorRetrieveChangeResponse, options: params[:request_options] ) end |
#run(monitor_id, request_options: {}) ⇒ ContextDev::Models::MonitorRunResponse
Triggers an immediate run of the monitor outside its normal schedule. The run is queued and processed asynchronously.
335 336 337 338 339 340 341 342 |
# File 'lib/context_dev/resources/monitors.rb', line 335 def run(monitor_id, params = {}) @client.request( method: :post, path: ["monitors/%1$s/run", monitor_id], model: ContextDev::Models::MonitorRunResponse, options: params[:request_options] ) end |
#update(monitor_id, change_detection: nil, name: nil, schedule: nil, status: nil, tags: nil, target: nil, webhook: nil, request_options: {}) ⇒ ContextDev::Models::MonitorUpdateResponse
Some parameter documentations has been truncated, see Models::MonitorUpdateParams for more details.
Updates a monitor. If target or change_detection changes, the monitor
creates a new baseline. Unsupported target/change detection combinations are
rejected.
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/context_dev/resources/monitors.rb', line 97 def update(monitor_id, params = {}) parsed, = ContextDev::MonitorUpdateParams.dump_request(params) @client.request( method: :patch, path: ["monitors/%1$s", monitor_id], body: parsed, model: ContextDev::Models::MonitorUpdateResponse, options: ) end |