Class: Twilio::REST::Monitor::V1::AlertInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Monitor::V1::AlertInstance
- Defined in:
- lib/twilio-ruby/rest/monitor/v1/alert.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The unique id of the Account responsible for this alert.
-
#alert_text ⇒ String
The text of the alert.
-
#api_version ⇒ String
The version of the Twilio API in use when this alert was generated.
-
#context ⇒ AlertContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The date that this resource was created, given in ISO 8601 format.
-
#date_generated ⇒ Time
The date the alert was actually generated, given in ISO 8601 format.
-
#date_updated ⇒ Time
The most recent date that this resource was updated, given in ISO 8601 format.
-
#delete ⇒ Boolean
Deletes the AlertInstance.
-
#error_code ⇒ String
A unique error code for the error condition.
-
#fetch ⇒ AlertInstance
Fetch a AlertInstance.
-
#initialize(version, payload, sid: nil) ⇒ AlertInstance
constructor
Initialize the AlertInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#log_level ⇒ String
A string representing the log level.
-
#more_info ⇒ String
A URL for more information about the error condition.
-
#request_method ⇒ String
If the Alert was generated by a request Twilio made to your server, this will be the request method used when Twilio made the request to your server.
-
#request_url ⇒ String
If the Alert was generated by a request Twilio made to your server, this will be the URL on your server that generated the alert.
-
#request_variables ⇒ String
The request_variables.
-
#resource_sid ⇒ String
The unique ID of the resource for which the Alert was generated.
-
#response_body ⇒ String
The response_body.
-
#response_headers ⇒ String
The response_headers.
-
#sid ⇒ String
A 34 character string that uniquely identifies this Alert.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#url ⇒ String
The absolute URL for this resource.
Constructor Details
#initialize(version, payload, sid: nil) ⇒ AlertInstance
Initialize the AlertInstance
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 252 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'], 'resource_sid' => payload['resource_sid'], 'sid' => payload['sid'], 'url' => payload['url'], 'request_variables' => payload['request_variables'], 'response_body' => payload['response_body'], 'response_headers' => payload['response_headers'], } # Context @instance_context = nil @params = {'sid' => sid || @properties['sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The unique id of the Account responsible for this alert.
294 295 296 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 294 def account_sid @properties['account_sid'] end |
#alert_text ⇒ String
Returns The text of the alert.
300 301 302 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 300 def alert_text @properties['alert_text'] end |
#api_version ⇒ String
Returns The version of the Twilio API in use when this alert was generated.
306 307 308 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 306 def api_version @properties['api_version'] end |
#context ⇒ AlertContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
285 286 287 288 289 290 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 285 def context unless @instance_context @instance_context = AlertContext.new(@version, @params['sid'], ) end @instance_context end |
#date_created ⇒ Time
Returns The date that this resource was created, given in ISO 8601 format.
312 313 314 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 312 def date_created @properties['date_created'] end |
#date_generated ⇒ Time
Returns The date the alert was actually generated, given in ISO 8601 format.
318 319 320 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 318 def date_generated @properties['date_generated'] end |
#date_updated ⇒ Time
Returns The most recent date that this resource was updated, given in ISO 8601 format.
324 325 326 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 324 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Deletes the AlertInstance
404 405 406 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 404 def delete context.delete end |
#error_code ⇒ String
Returns A unique error code for the error condition.
330 331 332 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 330 def error_code @properties['error_code'] end |
#fetch ⇒ AlertInstance
Fetch a AlertInstance
397 398 399 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 397 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
417 418 419 420 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 417 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Monitor.V1.AlertInstance #{values}>" end |
#log_level ⇒ String
Returns A string representing the log level.
336 337 338 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 336 def log_level @properties['log_level'] end |
#more_info ⇒ String
Returns A URL for more information about the error condition.
342 343 344 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 342 def more_info @properties['more_info'] end |
#request_method ⇒ String
Returns If the Alert was generated by a request Twilio made to your server, this will be the request method used when Twilio made the request to your server.
348 349 350 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 348 def request_method @properties['request_method'] end |
#request_url ⇒ String
Returns If the Alert was generated by a request Twilio made to your server, this will be the URL on your server that generated the alert.
354 355 356 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 354 def request_url @properties['request_url'] end |
#request_variables ⇒ String
Returns The request_variables.
360 361 362 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 360 def request_variables @properties['request_variables'] end |
#resource_sid ⇒ String
Returns The unique ID of the resource for which the Alert was generated.
366 367 368 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 366 def resource_sid @properties['resource_sid'] end |
#response_body ⇒ String
Returns The response_body.
372 373 374 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 372 def response_body @properties['response_body'] end |
#response_headers ⇒ String
Returns The response_headers.
378 379 380 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 378 def response_headers @properties['response_headers'] end |
#sid ⇒ String
Returns A 34 character string that uniquely identifies this Alert.
384 385 386 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 384 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
410 411 412 413 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 410 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Monitor.V1.AlertInstance #{values}>" end |
#url ⇒ String
Returns The absolute URL for this resource.
390 391 392 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 390 def url @properties['url'] end |