Class: Twilio::REST::Serverless::V1::ServiceInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the ServiceInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 353

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'friendly_name' => payload['friendly_name'],
        'unique_name' => payload['unique_name'],
        'include_credentials' => payload['include_credentials'],
        'ui_editable' => payload['ui_editable'],
        'domain_base' => payload['domain_base'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
        'links' => payload['links'],
    }

    # Context
    @instance_context = nil
    @params = { '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 Service resource.

Returns:



395
396
397
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 395

def 
    @properties['account_sid']
end

#assetsassets

Access the assets

Returns:



512
513
514
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 512

def assets
    context.assets
end

#buildsbuilds

Access the builds

Returns:



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

def builds
    context.builds
end

#contextServiceContext

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

Returns:



380
381
382
383
384
385
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 380

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

#date_createdTime

Returns The date and time in GMT when the Service resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



431
432
433
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 431

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the Service resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



437
438
439
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 437

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



456
457
458
459
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 456

def delete

    context.delete
end

#domain_baseString

Returns The base domain name for this Service, which is a combination of the unique name and a randomly generated string.

Returns:

  • (String)

    The base domain name for this Service, which is a combination of the unique name and a randomly generated string.



425
426
427
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 425

def domain_base
    @properties['domain_base']
end

#environmentsenvironments

Access the environments

Returns:



491
492
493
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 491

def environments
    context.environments
end

#fetchServiceInstance

Fetch the ServiceInstance

Returns:



464
465
466
467
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 464

def fetch

    context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the Service resource.

Returns:

  • (String)

    The string that you assigned to describe the Service resource.



401
402
403
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 401

def friendly_name
    @properties['friendly_name']
end

#functionsfunctions

Access the functions

Returns:



498
499
500
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 498

def functions
    context.functions
end

#include_credentialsBoolean

Returns Whether to inject Account credentials into a function invocation context.

Returns:

  • (Boolean)

    Whether to inject Account credentials into a function invocation context.



413
414
415
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 413

def include_credentials
    @properties['include_credentials']
end

#inspectObject

Provide a detailed, user friendly representation



525
526
527
528
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 525

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

Returns The URLs of the Service’s nested resources.

Returns:

  • (Hash)

    The URLs of the Service’s nested resources.



449
450
451
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 449

def links
    @properties['links']
end

#sidString

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

Returns:

  • (String)

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



389
390
391
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 389

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



518
519
520
521
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 518

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

#ui_editableBoolean

Returns Whether the Service resource’s properties and subresources can be edited via the UI.

Returns:

  • (Boolean)

    Whether the Service resource’s properties and subresources can be edited via the UI.



419
420
421
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 419

def ui_editable
    @properties['ui_editable']
end

#unique_nameString

Returns A user-defined string that uniquely identifies the Service resource. It can be used in place of the Service resource’s ‘sid` in the URL to address the Service resource.

Returns:

  • (String)

    A user-defined string that uniquely identifies the Service resource. It can be used in place of the Service resource’s ‘sid` in the URL to address the Service resource.



407
408
409
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 407

def unique_name
    @properties['unique_name']
end

#update(include_credentials: :unset, friendly_name: :unset, ui_editable: :unset) ⇒ ServiceInstance

Update the ServiceInstance

Parameters:

  • include_credentials (Boolean) (defaults to: :unset)

    Whether to inject Account credentials into a function invocation context.

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters.

  • ui_editable (Boolean) (defaults to: :unset)

    Whether the Service resource’s properties and subresources can be edited via the UI. The default value is ‘false`.

Returns:



475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 475

def update(
    include_credentials: :unset, 
    friendly_name: :unset, 
    ui_editable: :unset
)

    context.update(
        include_credentials: include_credentials, 
        friendly_name: friendly_name, 
        ui_editable: ui_editable, 
    )
end

#urlString

Returns The absolute URL of the Service resource.

Returns:

  • (String)

    The absolute URL of the Service resource.



443
444
445
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 443

def url
    @properties['url']
end