Class: Synthetics::API::Monitor

Inherits:
Base
  • Object
show all
Defined in:
lib/synthetics/api/monitor.rb

Overview

This class makes requests to the monitors section of the Synthetics API.

Instance Attribute Summary collapse

Attributes inherited from Base

#client

Instance Method Summary collapse

Constructor Details

#initialize(client, monitor_uuid) ⇒ Monitor

Returns a new instance of Monitor.



7
8
9
10
# File 'lib/synthetics/api/monitor.rb', line 7

def initialize(client, monitor_uuid)
  super(client)
  @monitor_uuid = monitor_uuid
end

Instance Attribute Details

#monitor_uuidObject (readonly)

Returns the value of attribute monitor_uuid.



5
6
7
# File 'lib/synthetics/api/monitor.rb', line 5

def monitor_uuid
  @monitor_uuid
end

Instance Method Details

#destroyObject



28
29
30
# File 'lib/synthetics/api/monitor.rb', line 28

def destroy
  request(path: "/monitors/#{monitor_uuid}", method: 'DELETE')
end

#showObject



12
13
14
# File 'lib/synthetics/api/monitor.rb', line 12

def show
  request(path: "/monitors/#{monitor_uuid}", method: 'GET')
end

#update(options) ⇒ Object



16
17
18
# File 'lib/synthetics/api/monitor.rb', line 16

def update(options)
  request(path: "/monitors/#{monitor_uuid}", method: 'PUT', body: options)
end

#update_script(str) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/synthetics/api/monitor.rb', line 20

def update_script(str)
  request(
    path: "/monitors/#{monitor_uuid}/script",
    method: 'PUT',
    body: { script_text: Base64.strict_encode64(str) }
  )
end