Class: Twilio::REST::Monitor::V1::AlertContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/monitor/v1/alert.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ AlertContext

Initialize the AlertContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The sid



176
177
178
179
180
181
182
183
184
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 176

def initialize(version, sid)
  super(version)

  # Path Solution
  @solution = {
      sid: sid,
  }
  @uri = "/Alerts/#{@solution[:sid]}"
end

Instance Method Details

#deleteBoolean

Deletes the AlertInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



208
209
210
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 208

def delete
  @version.delete('delete', @uri)
end

#fetchAlertInstance

Fetch a AlertInstance

Returns:



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 189

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  AlertInstance.new(
      @version,
      payload,
      sid: @solution[:sid],
  )
end

#to_sObject

Provide a user friendly representation



214
215
216
217
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 214

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Monitor.V1.AlertContext #{context}>"
end