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

  • account_sid (String)

    The SID of the Account that created this Event resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 468

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'],
        '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  || @properties['workspace_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Event resource.

Returns:



511
512
513
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 511

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.



517
518
519
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 517

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.



523
524
525
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 523

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.



529
530
531
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 529

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:



502
503
504
505
506
507
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 502

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.



535
536
537
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 535

def description
    @properties['description']
end

#event_dataHash

Returns Data about the event. For more information, see [Event types](www.twilio.com/docs/taskrouter/api/event#event-types).

Returns:



541
542
543
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 541

def event_data
    @properties['event_data']
end

#event_dateTime

Returns The time the event was sent, specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



547
548
549
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 547

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.



553
554
555
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 553

def event_date_ms
    @properties['event_date_ms']
end

#event_typeString

Returns The identifier for the event.

Returns:

  • (String)

    The identifier for the event.



559
560
561
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 559

def event_type
    @properties['event_type']
end

#fetchEventInstance

Fetch the EventInstance

Returns:



614
615
616
617
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 614

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



628
629
630
631
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 628

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, such as a TaskSid, ReservationSid, or a WorkerSid.

Returns:

  • (String)

    The SID of the object the event is most relevant to, such as a TaskSid, ReservationSid, or a WorkerSid.



565
566
567
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 565

def resource_sid
    @properties['resource_sid']
end

#resource_typeString

Returns The type of object the event is most relevant to, such as a Task, Reservation, or a Worker).

Returns:

  • (String)

    The type of object the event is most relevant to, such as a Task, Reservation, or a Worker).



571
572
573
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 571

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.



577
578
579
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 577

def resource_url
    @properties['resource_url']
end

#sidString

Returns The unique string that we created to identify the Event resource.

Returns:

  • (String)

    The unique string that we created to identify the Event resource.



583
584
585
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 583

def sid
    @properties['sid']
end

#sourceString

Returns Where the Event originated.

Returns:

  • (String)

    Where the Event originated.



589
590
591
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 589

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.



595
596
597
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 595

def source_ip_address
    @properties['source_ip_address']
end

#to_sObject

Provide a user friendly representation



621
622
623
624
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 621

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.



601
602
603
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 601

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.



607
608
609
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 607

def workspace_sid
    @properties['workspace_sid']
end