Class: Twilio::REST::Monitor::V1::AlertInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ AlertInstance

Initialize the AlertInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The SID of the Alert resource to fetch.


225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 225

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'alert_text' => payload['alert_text'],
      'api_version' => payload['api_version'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_generated' => Twilio.deserialize_iso8601_datetime(payload['date_generated']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'error_code' => payload['error_code'],
      'log_level' => payload['log_level'],
      'more_info' => payload['more_info'],
      'request_method' => payload['request_method'],
      'request_url' => payload['request_url'],
      'request_variables' => payload['request_variables'],
      'resource_sid' => payload['resource_sid'],
      'response_body' => payload['response_body'],
      'response_headers' => payload['response_headers'],
      'sid' => payload['sid'],
      'url' => payload['url'],
      'request_headers' => payload['request_headers'],
      'service_sid' => payload['service_sid'],
  }

  # Context
  @instance_context = nil
  @params = {'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource


269
270
271
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 269

def 
  @properties['account_sid']
end

#alert_textString

Returns The text of the alert.

Returns:

  • (String)

    The text of the alert


275
276
277
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 275

def alert_text
  @properties['alert_text']
end

#api_versionString

Returns The API version used when the alert was generated.

Returns:

  • (String)

    The API version used when the alert was generated


281
282
283
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 281

def api_version
  @properties['api_version']
end

#contextAlertContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:


260
261
262
263
264
265
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 260

def context
  unless @instance_context
    @instance_context = AlertContext.new(@version, @params['sid'], )
  end
  @instance_context
end

#date_createdTime

Returns The ISO 8601 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was created


287
288
289
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 287

def date_created
  @properties['date_created']
end

#date_generatedTime

Returns The date and time when the alert was generated specified in ISO 8601 format.

Returns:

  • (Time)

    The date and time when the alert was generated specified in ISO 8601 format


293
294
295
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 293

def date_generated
  @properties['date_generated']
end

#date_updatedTime

Returns The ISO 8601 date and time in GMT when the resource was last updated.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was last updated


299
300
301
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 299

def date_updated
  @properties['date_updated']
end

#error_codeString

Returns The error code for the condition that generated the alert.

Returns:

  • (String)

    The error code for the condition that generated the alert


305
306
307
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 305

def error_code
  @properties['error_code']
end

#fetchAlertInstance

Fetch the AlertInstance

Returns:


384
385
386
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 384

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


397
398
399
400
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 397

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Monitor.V1.AlertInstance #{values}>"
end

#log_levelString

Returns The log level.

Returns:

  • (String)

    The log level


311
312
313
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 311

def log_level
  @properties['log_level']
end

#more_infoString

Returns The URL of the page in our Error Dictionary with more information about the error condition.

Returns:

  • (String)

    The URL of the page in our Error Dictionary with more information about the error condition


317
318
319
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 317

def more_info
  @properties['more_info']
end

#request_headersString

Returns The request headers of the request that generated the alert.

Returns:

  • (String)

    The request headers of the request that generated the alert


371
372
373
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 371

def request_headers
  @properties['request_headers']
end

#request_methodString

Returns The method used by the request that generated the alert.

Returns:

  • (String)

    The method used by the request that generated the alert


323
324
325
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 323

def request_method
  @properties['request_method']
end

#request_urlString

Returns The URL of the request that generated the alert.

Returns:

  • (String)

    The URL of the request that generated the alert


329
330
331
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 329

def request_url
  @properties['request_url']
end

#request_variablesString

Returns The variables passed in the request that generated the alert.

Returns:

  • (String)

    The variables passed in the request that generated the alert


335
336
337
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 335

def request_variables
  @properties['request_variables']
end

#resource_sidString

Returns The SID of the resource for which the alert was generated.

Returns:

  • (String)

    The SID of the resource for which the alert was generated


341
342
343
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 341

def resource_sid
  @properties['resource_sid']
end

#response_bodyString

Returns The response body of the request that generated the alert.

Returns:

  • (String)

    The response body of the request that generated the alert


347
348
349
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 347

def response_body
  @properties['response_body']
end

#response_headersString

Returns The response headers of the request that generated the alert.

Returns:

  • (String)

    The response headers of the request that generated the alert


353
354
355
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 353

def response_headers
  @properties['response_headers']
end

#service_sidString

Returns The SID of the service or resource that generated the alert.

Returns:

  • (String)

    The SID of the service or resource that generated the alert


377
378
379
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 377

def service_sid
  @properties['service_sid']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


359
360
361
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 359

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


390
391
392
393
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 390

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Monitor.V1.AlertInstance #{values}>"
end

#urlString

Returns The absolute URL of the Alert resource.

Returns:

  • (String)

    The absolute URL of the Alert resource


365
366
367
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 365

def url
  @properties['url']
end