Class: Twilio::REST::Iam::V1::OAuthAppInstance

Inherits:
Twilio::REST::InstanceResource show all
Defined in:
lib/twilio-ruby/rest/iam/v1/o_auth_app.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ OAuthAppInstance

Initialize the OAuthAppInstance

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

  • sid (String) (defaults to: nil) —

    The SID of the Call resource to fetch.



441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 441

def initialize(version, payload , sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'type' => payload['type'],
        'sid' => payload['sid'],
        'friendly_name' => payload['friendly_name'],
        'description' => payload['description'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'created_by' => payload['created_by'],
        'creator_sid' => payload['creator_sid'],
        'secret' => payload['secret'],
        'status' => payload['status'],
        'policy' => payload['policy'],
        'access_token_ttl' => payload['access_token_ttl'] == nil ? payload['access_token_ttl'] : payload['access_token_ttl'].to_i,
        'code' => payload['code'],
        'message' => payload['message'],
        'more_info' => payload['more_info'],
    }

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

Instance Method Details

#access_token_ttl ⇒ String

Returns:

  • (String)


541
542
543
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 541

def access_token_ttl
    @properties['access_token_ttl']
end

#code ⇒ String

Returns Twilio-specific error code.

Returns:

  • (String) —

    Twilio-specific error code



547
548
549
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 547

def code
    @properties['code']
end

#context ⇒ OAuthAppContext

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

Returns:



472
473
474
475
476
477
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 472

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

#created_by ⇒ String

Returns:

  • (String)


511
512
513
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 511

def created_by
    @properties['created_by']
end

#creator_sid ⇒ String

Returns The unique identifier (SID) of the user who created this OAuth app.

Returns:

  • (String) —

    The unique identifier (SID) of the user who created this OAuth app.



517
518
519
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 517

def creator_sid
    @properties['creator_sid']
end

#date_created ⇒ Time

Returns:

  • (Time)


505
506
507
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 505

def date_created
    @properties['date_created']
end

#delete ⇒ Boolean

Delete the OAuthAppInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



566
567
568
569
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 566

def delete

    context.delete
end

#description ⇒ String

Returns:

  • (String)


499
500
501
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 499

def description
    @properties['description']
end

#friendly_name ⇒ String

Returns:

  • (String)


493
494
495
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 493

def friendly_name
    @properties['friendly_name']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



592
593
594
595
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 592

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

#message ⇒ String

Returns Error message.

Returns:

  • (String) —

    Error message



553
554
555
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 553

def message
    @properties['message']
end

#more_info ⇒ String

Returns Link to Error Code References.

Returns:

  • (String) —

    Link to Error Code References



559
560
561
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 559

def more_info
    @properties['more_info']
end

#policy ⇒ IamV1OrganizationVendoroauthappPolicy

Returns:

  • (IamV1OrganizationVendoroauthappPolicy)


535
536
537
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 535

def policy
    @properties['policy']
end

#secret ⇒ String

Returns:

  • (String)


523
524
525
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 523

def secret
    @properties['secret']
end

#sid ⇒ String

Returns:

  • (String)


487
488
489
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 487

def sid
    @properties['sid']
end

#status ⇒ String

Returns:

  • (String)


529
530
531
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 529

def status
    @properties['status']
end

#to_s ⇒ Object

Provide a user friendly representation



585
586
587
588
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 585

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

#type ⇒ String

Returns:

  • (String)


481
482
483
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 481

def type
    @properties['type']
end

#update(iam_v1_account_vendor_oauth_app_update_request: nil) ⇒ OAuthAppInstance

Update the OAuthAppInstance

Parameters:

  • iam_v1_account_vendor_oauth_app_update_request (IamV1AccountVendorOauthAppUpdateRequest) (defaults to: nil)

Returns:



575
576
577
578
579
580
581
# File 'lib/twilio-ruby/rest/iam/v1/o_auth_app.rb', line 575

def update(iam_v1_account_vendor_oauth_app_update_request: nil
)

    context.update(
        iam_v1_account_vendor_oauth_app_update_request: , 
    )
end