Class: Twilio::REST::Webhooks::V1::SharedKeyInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, shared_key_id: nil) ⇒ SharedKeyInstance

Initialize the SharedKeyInstance

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

  • sid (String) —

    The SID of the Call resource to fetch.



581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 581

def initialize(version, payload , shared_key_id: nil)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)
    
    # Marshaled Properties
    @properties = { 
        'id' => payload['id'],
        'friendly_name' => payload['friendly_name'],
        'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
        'updated_at' => Twilio.deserialize_iso8601_datetime(payload['updated_at']),
        'secret' => payload['secret'],
        'type' => payload['type'],
        'title' => payload['title'],
        'status' => payload['status'] == nil ? payload['status'] : payload['status'].to_i,
        'detail' => payload['detail'],
        'code' => payload['code'] == nil ? payload['code'] : payload['code'].to_i,
    }

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

Instance Method Details

#code ⇒ String

Returns:

  • (String)


672
673
674
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 672

def code
    @properties['code']
end

#context ⇒ SharedKeyContext

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

Returns:



609
610
611
612
613
614
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 609

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

#created_at ⇒ Time

Returns:

  • (Time)


630
631
632
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 630

def created_at
    @properties['created_at']
end

#delete ⇒ Boolean

Delete the SharedKeyInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



679
680
681
682
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 679

def delete

    context.delete
end

#detail ⇒ String

Returns:

  • (String)


666
667
668
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 666

def detail
    @properties['detail']
end

#fetch ⇒ SharedKeyInstance

Fetch the SharedKeyInstance

Returns:



687
688
689
690
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 687

def fetch

    context.fetch
end

#friendly_name ⇒ String

Returns Human-readable name for identification.

Returns:

  • (String) —

    Human-readable name for identification



624
625
626
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 624

def friendly_name
    @properties['friendly_name']
end

#id ⇒ String

Returns Unique SharedKey identifier (TypeID/TTID format).

Returns:

  • (String) —

    Unique SharedKey identifier (TypeID/TTID format)



618
619
620
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 618

def id
    @properties['id']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



713
714
715
716
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 713

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

#patch(patch_shared_key: nil) ⇒ SharedKeyInstance

Patch the SharedKeyInstance

Parameters:

  • patch_shared_key (PatchSharedKey) (defaults to: nil)

Returns:



696
697
698
699
700
701
702
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 696

def patch(patch_shared_key: nil
)

    context.patch(
        patch_shared_key: patch_shared_key, 
    )
end

#secret ⇒ String

Returns Signing secret (only returned on POST, cannot be retrieved later).

Returns:

  • (String) —

    Signing secret (only returned on POST, cannot be retrieved later)



642
643
644
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 642

def secret
    @properties['secret']
end

#status ⇒ String

Returns:

  • (String)


660
661
662
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 660

def status
    @properties['status']
end

#title ⇒ String

Returns:

  • (String)


654
655
656
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 654

def title
    @properties['title']
end

#to_s ⇒ Object

Provide a user friendly representation



706
707
708
709
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 706

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

#type ⇒ String

Returns:

  • (String)


648
649
650
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 648

def type
    @properties['type']
end

#updated_at ⇒ Time

Returns:

  • (Time)


636
637
638
# File 'lib/twilio-ruby/rest/webhooks/v1/shared_key.rb', line 636

def updated_at
    @properties['updated_at']
end