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.



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 383

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

#contextEventTypeContext

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

Returns:



409
410
411
412
413
414
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 409

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

#date_createdTime

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.



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

def date_created
    @properties['date_created']
end

#date_updatedTime

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.



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

def date_updated
    @properties['date_updated']
end

#descriptionString

Returns A human readable description for this Event Type.

Returns:

  • (String)

    A human readable description for this Event Type.



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

def description
    @properties['description']
end

#documentation_urlString

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.



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

def documentation_url
    @properties['documentation_url']
end

#fetchEventTypeInstance

Fetch the EventTypeInstance

Returns:



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

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

Returns:

  • (Hash)


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

def links
    @properties['links']
end

#schema_idString

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.



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

def schema_id
    @properties['schema_id']
end

#statusString

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.



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

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



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

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

#typeString

Returns A string that uniquely identifies this Event Type.

Returns:

  • (String)

    A string that uniquely identifies this Event Type.



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

def type
    @properties['type']
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



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

def url
    @properties['url']
end