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 of the Alert resource to fetch.


186
187
188
189
190
191
192
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 186

def initialize(version, sid)
  super(version)

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

Instance Method Details

#fetchAlertInstance

Fetch the AlertInstance

Returns:


197
198
199
200
201
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 197

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

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

#inspectObject

Provide a detailed, user friendly representation


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

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

#to_sObject

Provide a user friendly representation


205
206
207
208
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 205

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