Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::EventInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb

Instance Method Summary collapse

Constructor Details

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

Initialize the EventInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • workspace_sid (String) (defaults to: nil)

    The SID of the Workspace that contains the Event.

  • sid (String) (defaults to: nil)

    The SID of the Event resource to fetch.



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 306

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

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

  # Context
  @instance_context = nil
  @params = {'workspace_sid' => workspace_sid, '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



348
349
350
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 348

def 
  @properties['account_sid']
end

#actor_sidString

Returns The SID of the resource that triggered the event.

Returns:

  • (String)

    The SID of the resource that triggered the event



354
355
356
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 354

def actor_sid
  @properties['actor_sid']
end

#actor_typeString

Returns The type of resource that triggered the event.

Returns:

  • (String)

    The type of resource that triggered the event



360
361
362
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 360

def actor_type
  @properties['actor_type']
end

#actor_urlString

Returns The absolute URL of the resource that triggered the event.

Returns:

  • (String)

    The absolute URL of the resource that triggered the event



366
367
368
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 366

def actor_url
  @properties['actor_url']
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:



339
340
341
342
343
344
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 339

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

#descriptionString

Returns A description of the event.

Returns:

  • (String)

    A description of the event



372
373
374
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 372

def description
  @properties['description']
end

#event_dataHash

Returns Data about the event.

Returns:

  • (Hash)

    Data about the event



378
379
380
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 378

def event_data
  @properties['event_data']
end

#event_dateTime

Returns The time the event was sent.

Returns:

  • (Time)

    The time the event was sent



384
385
386
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 384

def event_date
  @properties['event_date']
end

#event_date_msString

Returns The time the event was sent in milliseconds.

Returns:

  • (String)

    The time the event was sent in milliseconds



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

def event_date_ms
  @properties['event_date_ms']
end

#event_typeString

Returns The identifier for the event.

Returns:

  • (String)

    The identifier for the event



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

def event_type
  @properties['event_type']
end

#fetchEventInstance

Fetch a EventInstance

Returns:



451
452
453
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 451

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



464
465
466
467
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 464

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

#resource_sidString

Returns The SID of the object the event is most relevant to.

Returns:

  • (String)

    The SID of the object the event is most relevant to



402
403
404
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 402

def resource_sid
  @properties['resource_sid']
end

#resource_typeString

Returns The type of object the event is most relevant to.

Returns:

  • (String)

    The type of object the event is most relevant to



408
409
410
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 408

def resource_type
  @properties['resource_type']
end

#resource_urlString

Returns The URL of the resource the event is most relevant to.

Returns:

  • (String)

    The URL of the resource the event is most relevant to



414
415
416
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 414

def resource_url
  @properties['resource_url']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



420
421
422
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 420

def sid
  @properties['sid']
end

#sourceString

Returns Where the Event originated.

Returns:

  • (String)

    Where the Event originated



426
427
428
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 426

def source
  @properties['source']
end

#source_ip_addressString

Returns The IP from which the Event originated.

Returns:

  • (String)

    The IP from which the Event originated



432
433
434
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 432

def source_ip_address
  @properties['source_ip_address']
end

#to_sObject

Provide a user friendly representation



457
458
459
460
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 457

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

#urlString

Returns The absolute URL of the Event resource.

Returns:

  • (String)

    The absolute URL of the Event resource



438
439
440
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 438

def url
  @properties['url']
end

#workspace_sidString

Returns The SID of the Workspace that contains the Event.

Returns:

  • (String)

    The SID of the Workspace that contains the Event



444
445
446
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 444

def workspace_sid
  @properties['workspace_sid']
end