Class: Twilio::REST::Events::V1::EventTypeInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, type: nil) ⇒ EventTypeInstance

Initialize the EventTypeInstance

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 EventType resource.

  • sid (String) —

    The SID of the Call resource to fetch.



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 391

def initialize(version, payload , type: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'type' => payload['type'],
        'schema_id' => payload['schema_id'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'description' => payload['description'],
        'status' => payload['status'],
        'documentation_url' => payload['documentation_url'],
        'url' => payload['url'],
        'links' => payload['links'],
    }

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

Instance Method Details

#context ⇒ EventTypeContext

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

Returns:



417
418
419
420
421
422
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 417

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

#date_created ⇒ Time

Returns The date that this Event Type was created, given in ISO 8601 format.

Returns:

  • (Time) —

    The date that this Event Type was created, given in ISO 8601 format.



438
439
440
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 438

def date_created
    @properties['date_created']
end

#date_updated ⇒ Time

Returns The date that this Event Type was updated, given in ISO 8601 format.

Returns:

  • (Time) —

    The date that this Event Type was updated, given in ISO 8601 format.



444
445
446
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 444

def date_updated
    @properties['date_updated']
end

#description ⇒ String

Returns A human readable description for this Event Type.

Returns:

  • (String) —

    A human readable description for this Event Type.



450
451
452
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 450

def description
    @properties['description']
end

#documentation_url ⇒ String

Returns The URL to the documentation or to the most relevant Twilio Changelog entry of this Event Type.

Returns:

  • (String) —

    The URL to the documentation or to the most relevant Twilio Changelog entry of this Event Type.



462
463
464
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 462

def documentation_url
    @properties['documentation_url']
end

#fetch ⇒ EventTypeInstance

Fetch the EventTypeInstance

Returns:



481
482
483
484
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 481

def fetch

    context.fetch
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



495
496
497
498
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 495

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

Returns:

  • (Hash)


474
475
476
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 474

def links
    @properties['links']
end

#schema_id ⇒ String

Returns A string that uniquely identifies the Schema this Event Type adheres to.

Returns:

  • (String) —

    A string that uniquely identifies the Schema this Event Type adheres to.



432
433
434
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 432

def schema_id
    @properties['schema_id']
end

#status ⇒ String

Returns A string that describes how this Event Type can be used. For example: available, deprecated, restricted, discontinued. When the status is available, the Event Type can be used normally.

Returns:

  • (String) —

    A string that describes how this Event Type can be used. For example: available, deprecated, restricted, discontinued. When the status is available, the Event Type can be used normally.



456
457
458
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 456

def status
    @properties['status']
end

#to_s ⇒ Object

Provide a user friendly representation



488
489
490
491
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 488

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

#type ⇒ String

Returns A string that uniquely identifies this Event Type.

Returns:

  • (String) —

    A string that uniquely identifies this Event Type.



426
427
428
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 426

def type
    @properties['type']
end

#url ⇒ String

Returns The URL of this resource.

Returns:

  • (String) —

    The URL of this resource.



468
469
470
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 468

def url
    @properties['url']
end