Class: Twilio::REST::Monitor::V1::EventInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the EventInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this event.



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 259

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

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'actor_sid' => payload['actor_sid'],
      'actor_type' => payload['actor_type'],
      'description' => payload['description'],
      'event_data' => payload['event_data'],
      'event_date' => Twilio.deserialize_iso8601_datetime(payload['event_date']),
      'event_type' => payload['event_type'],
      'resource_sid' => payload['resource_sid'],
      'resource_type' => payload['resource_type'],
      'sid' => payload['sid'],
      'source' => payload['source'],
      'source_ip_address' => payload['source_ip_address'],
      'url' => payload['url'],
      'links' => payload['links'],
  }

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

Instance Method Details

#account_sidString

Returns A 34 character string identifying the Account for which this Event was recorded.

Returns:

  • (String)

    A 34 character string identifying the Account for which this Event was recorded.



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

def 
  @properties['account_sid']
end

#actor_sidString

Returns If available, a 34 character string identifying the actor that caused this event. May be null.

Returns:

  • (String)

    If available, a 34 character string identifying the actor that caused this event. May be null.



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

def actor_sid
  @properties['actor_sid']
end

#actor_typeString

Returns The type of actor that caused this event.

Returns:

  • (String)

    The type of actor that caused this event



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

def actor_type
  @properties['actor_type']
end

#contextEventContext

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

Returns:



289
290
291
292
293
294
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 289

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

#descriptionString

Returns A human-readable description of the event. May be null.

Returns:

  • (String)

    A human-readable description of the event. May be null.



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

def description
  @properties['description']
end

#event_dataHash

Returns A freeform json object encoding additional data about the event.

Returns:

  • (Hash)

    A freeform json object encoding additional data about the event



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

def event_data
  @properties['event_data']
end

#event_dateTime

Returns The date-time the event was recorded.

Returns:

  • (Time)

    The date-time the event was recorded



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

def event_date
  @properties['event_date']
end

#event_typeString

Returns The event’s type, as a string.

Returns:

  • (String)

    The event’s type, as a string.



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

def event_type
  @properties['event_type']
end

#fetchEventInstance

Fetch a EventInstance

Returns:



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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

Returns The links.

Returns:

  • (String)

    The links



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

def links
  @properties['links']
end

#resource_sidString

Returns A 34 character string identifying the resource that was affected.

Returns:

  • (String)

    A 34 character string identifying the resource that was affected.



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

def resource_sid
  @properties['resource_sid']
end

#resource_typeString

Returns The type of resource that was affected.

Returns:

  • (String)

    The type of resource that was affected



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

def resource_type
  @properties['resource_type']
end

#sidString

Returns A 34 character string that uniquely identifies this event.

Returns:

  • (String)

    A 34 character string that uniquely identifies this event.



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

def sid
  @properties['sid']
end

#sourceString

Returns The originating system or interface that caused the event. web for events caused by user action in the Twilio Console. api for events caused through a request to the REST API. twilio for events caused by an automated or internal Twilio system.

Returns:

  • (String)

    The originating system or interface that caused the event. web for events caused by user action in the Twilio Console. api for events caused through a request to the REST API. twilio for events caused by an automated or internal Twilio system.



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

def source
  @properties['source']
end

#source_ip_addressString

Returns The IP address of the source.

Returns:

  • (String)

    The IP address of the source



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

def source_ip_address
  @properties['source_ip_address']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString

Returns The url.

Returns:

  • (String)

    The url



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

def url
  @properties['url']
end