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

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

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

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

  • sid (String) (defaults to: nil)

    The sid or unique_name of the Service resource to fetch.



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 338

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'],
      '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 that created the Service resource.

Returns:

  • (String)

    The SID of the Account that created the Service resource



378
379
380
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 378

def 
  @properties['account_sid']
end

#assetsassets

Access the assets

Returns:



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

def assets
  context.assets
end

#buildsbuilds

Access the builds

Returns:



473
474
475
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 473

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:



363
364
365
366
367
368
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 363

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

#date_createdTime

Returns The ISO 8601 date and time in GMT when the Service resource was created.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the Service resource was created



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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The ISO 8601 date and time in GMT when the Service resource was last updated.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the Service resource was last updated



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ServiceInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



434
435
436
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 434

def delete
  context.delete
end

#environmentsenvironments

Access the environments

Returns:



452
453
454
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 452

def environments
  context.environments
end

#fetchServiceInstance

Fetch a ServiceInstance

Returns:



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

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



384
385
386
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 384

def friendly_name
  @properties['friendly_name']
end

#functionsfunctions

Access the functions

Returns:



459
460
461
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 459

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



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

def include_credentials
  @properties['include_credentials']
end

#inspectObject

Provide a detailed, user friendly representation



486
487
488
489
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 486

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:

  • (String)

    The URLs of the Service’s nested resources



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

def links
  @properties['links']
end

#sidString

Returns The unique string that identifies the Service resource.

Returns:

  • (String)

    The unique string that identifies the Service resource



372
373
374
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 372

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



479
480
481
482
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 479

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

#unique_nameString

Returns An application-defined string that uniquely identifies the Service resource.

Returns:

  • (String)

    An application-defined string that uniquely identifies the Service resource



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

def unique_name
  @properties['unique_name']
end

#update(include_credentials: :unset, friendly_name: :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 up to 255 characters long.

Returns:



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

def update(include_credentials: :unset, friendly_name: :unset)
  context.update(include_credentials: include_credentials, friendly_name: friendly_name, )
end

#urlString

Returns The absolute URL of the Service resource.

Returns:

  • (String)

    The absolute URL of the Service resource



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

def url
  @properties['url']
end