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 workspace_sid

  • sid (String) (defaults to: nil)

    The sid



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 297

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 account owning this event.

Returns:

  • (String)

    The account owning this event



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

def 
  @properties['account_sid']
end

#actor_sidString

Returns The actor_sid.

Returns:

  • (String)

    The actor_sid



345
346
347
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 345

def actor_sid
  @properties['actor_sid']
end

#actor_typeString

Returns The actor_type.

Returns:

  • (String)

    The actor_type



351
352
353
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 351

def actor_type
  @properties['actor_type']
end

#actor_urlString

Returns The actor_url.

Returns:

  • (String)

    The actor_url



357
358
359
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 357

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:



330
331
332
333
334
335
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 330

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



363
364
365
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 363

def description
  @properties['description']
end

#event_dataHash

Returns Data about this specific event.

Returns:

  • (Hash)

    Data about this specific event.



369
370
371
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 369

def event_data
  @properties['event_data']
end

#event_dateTime

Returns The time this event was sent.

Returns:

  • (Time)

    The time this event was sent



375
376
377
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 375

def event_date
  @properties['event_date']
end

#event_date_msString

Returns The time this event was sent in ms.

Returns:

  • (String)

    The time this event was sent in ms



381
382
383
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 381

def event_date_ms
  @properties['event_date_ms']
end

#event_typeString

Returns An identifier for this event.

Returns:

  • (String)

    An identifier for this event



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

def event_type
  @properties['event_type']
end

#fetchEventInstance

Fetch a EventInstance

Returns:



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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#resource_sidString

Returns The sid of the object this event is most relevant to.

Returns:

  • (String)

    The sid of the object this event is most relevant to



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

def resource_sid
  @properties['resource_sid']
end

#resource_typeString

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

Returns:

  • (String)

    The type of object this event is most relevant to



399
400
401
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 399

def resource_type
  @properties['resource_type']
end

#resource_urlString

Returns The resource_url.

Returns:

  • (String)

    The resource_url



405
406
407
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 405

def resource_url
  @properties['resource_url']
end

#sidString

Returns The sid.

Returns:

  • (String)

    The sid



411
412
413
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 411

def sid
  @properties['sid']
end

#sourceString

Returns The source.

Returns:

  • (String)

    The source



417
418
419
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 417

def source
  @properties['source']
end

#source_ip_addressString

Returns The source_ip_address.

Returns:

  • (String)

    The source_ip_address



423
424
425
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 423

def source_ip_address
  @properties['source_ip_address']
end

#to_sObject

Provide a user friendly representation



448
449
450
451
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 448

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

#urlString

Returns The url.

Returns:

  • (String)

    The url



429
430
431
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 429

def url
  @properties['url']
end

#workspace_sidString

Returns The workspace_sid.

Returns:

  • (String)

    The workspace_sid



435
436
437
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 435

def workspace_sid
  @properties['workspace_sid']
end