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
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 245 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.
287 288 289 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 287 def account_sid @properties['account_sid'] end |
#alert_text ⇒ String
Returns The text of the alert.
293 294 295 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 293 def alert_text @properties['alert_text'] end |
#api_version ⇒ String
Returns The version of the Twilio API in use when this alert was generated.
299 300 301 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 299 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
278 279 280 281 282 283 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 278 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.
305 306 307 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 305 def date_created @properties['date_created'] end |
#date_generated ⇒ Time
Returns The date the alert was actually generated, given in ISO 8601 format.
311 312 313 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 311 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.
317 318 319 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 317 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Deletes the AlertInstance
397 398 399 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 397 def delete context.delete end |
#error_code ⇒ String
Returns A unique error code for the error condition.
323 324 325 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 323 def error_code @properties['error_code'] end |
#fetch ⇒ AlertInstance
Fetch a AlertInstance
390 391 392 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 390 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
410 411 412 413 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 410 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.
329 330 331 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 329 def log_level @properties['log_level'] end |
#more_info ⇒ String
Returns A URL for more information about the error condition.
335 336 337 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 335 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.
341 342 343 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 341 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.
347 348 349 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 347 def request_url @properties['request_url'] end |
#request_variables ⇒ String
Returns The request_variables.
353 354 355 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 353 def request_variables @properties['request_variables'] end |
#resource_sid ⇒ String
Returns The unique ID of the resource for which the Alert was generated.
359 360 361 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 359 def resource_sid @properties['resource_sid'] end |
#response_body ⇒ String
Returns The response_body.
365 366 367 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 365 def response_body @properties['response_body'] end |
#response_headers ⇒ String
Returns The response_headers.
371 372 373 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 371 def response_headers @properties['response_headers'] end |
#sid ⇒ String
Returns A 34 character string that uniquely identifies this Alert.
377 378 379 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 377 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
403 404 405 406 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 403 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.
383 384 385 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 383 def url @properties['url'] end |