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 SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Alert resource.
-
#alert_text ⇒ String
The text of the alert.
-
#api_version ⇒ String
The API version used when the 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 and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
-
#date_generated ⇒ Time
The date and time in GMT when the alert was generated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601#UTC) format.
-
#date_updated ⇒ Time
The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
-
#error_code ⇒ String
The error code for the condition that generated the alert.
-
#fetch ⇒ AlertInstance
Fetch the AlertInstance.
-
#initialize(version, payload, sid: nil) ⇒ AlertInstance
constructor
Initialize the AlertInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#log_level ⇒ String
The log level.
-
#more_info ⇒ String
The URL of the page in our [Error Dictionary](www.twilio.com/docs/api/errors) with more information about the error condition.
-
#request_headers ⇒ String
The request headers of the request that generated the alert.
-
#request_method ⇒ String
The method used by the request that generated the alert.
-
#request_url ⇒ String
The URL of the request that generated the alert.
-
#request_variables ⇒ String
The variables passed in the request that generated the alert.
-
#resource_sid ⇒ String
The SID of the resource for which the alert was generated.
-
#response_body ⇒ String
The response body of the request that generated the alert.
-
#response_headers ⇒ String
The response headers of the request that generated the alert.
-
#service_sid ⇒ String
The SID of the service or resource that generated the alert.
-
#sid ⇒ String
The unique string that we created to identify the Alert resource.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#url ⇒ String
The absolute URL of the Alert resource.
Constructor Details
#initialize(version, payload, sid: nil) ⇒ AlertInstance
Initialize the AlertInstance
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 255 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 226 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_sid ⇒ String
Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Alert resource.
270 271 272 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 270 def account_sid @properties['account_sid'] end |
#alert_text ⇒ String
Returns The text of the alert.
276 277 278 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 276 def alert_text @properties['alert_text'] end |
#api_version ⇒ String
Returns The API version used when the alert was generated. Can be empty for events that don’t have a specific API version.
282 283 284 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 282 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
261 262 263 264 265 266 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 261 def context unless @instance_context @instance_context = AlertContext.new(@version , @params['sid']) end @instance_context end |
#date_created ⇒ Time
Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
288 289 290 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 288 def date_created @properties['date_created'] end |
#date_generated ⇒ Time
Returns The date and time in GMT when the alert was generated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601#UTC) format. Due to buffering, this can be different than ‘date_created`.
294 295 296 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 294 def date_generated @properties['date_generated'] end |
#date_updated ⇒ Time
Returns The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
300 301 302 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 300 def date_updated @properties['date_updated'] end |
#error_code ⇒ String
Returns The error code for the condition that generated the alert. See the [Error Dictionary](www.twilio.com/docs/api/errors) for possible causes and solutions to the error.
306 307 308 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 306 def error_code @properties['error_code'] end |
#fetch ⇒ AlertInstance
Fetch the AlertInstance
385 386 387 388 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 385 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
399 400 401 402 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 399 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Monitor.V1.AlertInstance #{values}>" end |
#log_level ⇒ String
Returns The log level. Can be: ‘error`, `warning`, `notice`, or `debug`.
312 313 314 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 312 def log_level @properties['log_level'] end |
#more_info ⇒ String
Returns The URL of the page in our [Error Dictionary](www.twilio.com/docs/api/errors) with more information about the error condition.
318 319 320 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 318 def more_info @properties['more_info'] end |
#request_headers ⇒ String
Returns The request headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched.
372 373 374 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 372 def request_headers @properties['request_headers'] end |
#request_method ⇒ String
Returns The method used by the request that generated the alert. If the alert was generated by a request we made to your server, this is the method we used. If the alert was generated by a request from your application to our API, this is the method your application used.
324 325 326 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 324 def request_method @properties['request_method'] end |
#request_url ⇒ String
Returns The URL of the request that generated the alert. If the alert was generated by a request we made to your server, this is the URL on your server that generated the alert. If the alert was generated by a request from your application to our API, this is the URL of the resource requested.
330 331 332 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 330 def request_url @properties['request_url'] end |
#request_variables ⇒ String
Returns The variables passed in the request that generated the alert. This value is only returned when a single Alert resource is fetched.
336 337 338 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 336 def request_variables @properties['request_variables'] end |
#resource_sid ⇒ String
Returns The SID of the resource for which the alert was generated. For instance, if your server failed to respond to an HTTP request during the flow of a particular call, this value would be the SID of the server. This value is empty if the alert was not generated for a particular resource.
342 343 344 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 342 def resource_sid @properties['resource_sid'] end |
#response_body ⇒ String
Returns The response body of the request that generated the alert. This value is only returned when a single Alert resource is fetched.
348 349 350 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 348 def response_body @properties['response_body'] end |
#response_headers ⇒ String
Returns The response headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched.
354 355 356 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 354 def response_headers @properties['response_headers'] end |
#service_sid ⇒ String
Returns The SID of the service or resource that generated the alert. Can be ‘null`.
378 379 380 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 378 def service_sid @properties['service_sid'] end |
#sid ⇒ String
Returns The unique string that we created to identify the Alert resource.
360 361 362 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 360 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
392 393 394 395 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 392 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Monitor.V1.AlertInstance #{values}>" end |
#url ⇒ String
Returns The absolute URL of the Alert resource.
366 367 368 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 366 def url @properties['url'] end |