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)

    The SID of the Event resource to fetch.



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

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 The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



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

def 
  @properties['account_sid']
end

#actor_sidString

Returns The SID of the actor that caused the event, if available.

Returns:

  • (String)

    The SID of the actor that caused the event, if available



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

def actor_sid
  @properties['actor_sid']
end

#actor_typeString

Returns The type of actor that caused the event.

Returns:

  • (String)

    The type of actor that caused the event



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

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:



293
294
295
296
297
298
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 293

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

#descriptionString

Returns A description of the event.

Returns:

  • (String)

    A description of the event



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

def description
  @properties['description']
end

#event_dataHash

Returns A JSON string that represents an object with additional data about the event.

Returns:

  • (Hash)

    A JSON string that represents an object with additional data about the event



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

def event_data
  @properties['event_data']
end

#event_dateTime

Returns The ISO 8601 date and time in GMT when the event was recorded.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the event was recorded



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

def event_date
  @properties['event_date']
end

#event_typeString

Returns The event’s type.

Returns:

  • (String)

    The event’s type



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

def event_type
  @properties['event_type']
end

#fetchEventInstance

Fetch a EventInstance

Returns:



387
388
389
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 387

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



400
401
402
403
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 400

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

Returns The absolute URLs of related resources.

Returns:

  • (String)

    The absolute URLs of related resources



380
381
382
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 380

def links
  @properties['links']
end

#resource_sidString

Returns The SID of the resource that was affected.

Returns:

  • (String)

    The SID of the resource that was affected



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

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



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

def resource_type
  @properties['resource_type']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



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

def sid
  @properties['sid']
end

#sourceString

Returns The originating system or interface that caused the event.

Returns:

  • (String)

    The originating system or interface that caused the event



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

def source
  @properties['source']
end

#source_ip_addressString

Returns The IP address of the source.

Returns:

  • (String)

    The IP address of the source



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

def source_ip_address
  @properties['source_ip_address']
end

#to_sObject

Provide a user friendly representation



393
394
395
396
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 393

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

#urlString

Returns The absolute URL of the resource that was affected.

Returns:

  • (String)

    The absolute URL of the resource that was affected



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

def url
  @properties['url']
end