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. Webhook payloads are documented by the MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload schemas.
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.
-
#get_credit_usage(since: nil, until_: nil, request_options: {}) ⇒ ContextDev::Models::MonitorGetCreditUsageResponse
Returns credits charged per monitor over an optional [since, until] window, newest spenders first.
-
#get_limits(request_options: {}) ⇒ ContextDev::Models::MonitorGetLimitsResponse
Returns how many monitors the account has and the maximum it allows.
-
#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
Returns an account-wide feed of monitor runs across all monitors.
-
#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
List monitor runs.
-
#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.
386 387 388 |
# File 'lib/context_dev/resources/monitors.rb', line 386 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.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/context_dev/resources/monitors.rb', line 38 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
165 166 167 168 169 170 171 172 |
# File 'lib/context_dev/resources/monitors.rb', line 165 def delete(monitor_id, params = {}) @client.request( method: :delete, path: ["monitors/%1$s", monitor_id], model: ContextDev::Models::MonitorDeleteResponse, options: params[:request_options] ) end |
#get_credit_usage(since: nil, until_: nil, request_options: {}) ⇒ ContextDev::Models::MonitorGetCreditUsageResponse
Returns credits charged per monitor over an optional [since, until] window, newest spenders first.
188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/context_dev/resources/monitors.rb', line 188 def get_credit_usage(params = {}) parsed, = ContextDev::MonitorGetCreditUsageParams.dump_request(params) query = ContextDev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "monitors/credit-usage", query: query.transform_keys(until_: "until"), model: ContextDev::Models::MonitorGetCreditUsageResponse, options: ) end |
#get_limits(request_options: {}) ⇒ ContextDev::Models::MonitorGetLimitsResponse
Returns how many monitors the account has and the maximum it allows.
209 210 211 212 213 214 215 216 |
# File 'lib/context_dev/resources/monitors.rb', line 209 def get_limits(params = {}) @client.request( method: :get, path: "monitors/limits", model: ContextDev::Models::MonitorGetLimitsResponse, 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.
143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/context_dev/resources/monitors.rb', line 143 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.
243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/context_dev/resources/monitors.rb', line 243 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
Returns an account-wide feed of monitor runs across all monitors.
270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/context_dev/resources/monitors.rb', line 270 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
303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/context_dev/resources/monitors.rb', line 303 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
List monitor runs
332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/context_dev/resources/monitors.rb', line 332 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
59 60 61 62 63 64 65 66 |
# File 'lib/context_dev/resources/monitors.rb', line 59 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
354 355 356 357 358 359 360 361 |
# File 'lib/context_dev/resources/monitors.rb', line 354 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.
374 375 376 377 378 379 380 381 |
# File 'lib/context_dev/resources/monitors.rb', line 374 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.
98 99 100 101 102 103 104 105 106 107 |
# File 'lib/context_dev/resources/monitors.rb', line 98 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 |