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



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 324

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_sid ⇒ String

Returns The account_sid.

Returns:

  • (String) —

    The account_sid



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

def 
  @properties['account_sid']
end

#assets ⇒ assets

Access the assets

Returns:



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

def assets
  context.assets
end

#builds ⇒ builds

Access the builds

Returns:



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

def builds
  context.builds
end

#context ⇒ ServiceContext

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

Returns:



349
350
351
352
353
354
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 349

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

#date_created ⇒ Time

Returns The date_created.

Returns:

  • (Time) —

    The date_created



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

def date_created
  @properties['date_created']
end

#date_updated ⇒ Time

Returns The date_updated.

Returns:

  • (Time) —

    The date_updated



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

def date_updated
  @properties['date_updated']
end

#environments ⇒ environments

Access the environments

Returns:



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

def environments
  context.environments
end

#fetch ⇒ ServiceInstance

Fetch a ServiceInstance

Returns:



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

def fetch
  context.fetch
end

#friendly_name ⇒ String

Returns The friendly_name.

Returns:

  • (String) —

    The friendly_name



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

def friendly_name
  @properties['friendly_name']
end

#functions ⇒ functions

Access the functions

Returns:



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

def functions
  context.functions
end

#include_credentials ⇒ Boolean

Returns The include_credentials.

Returns:

  • (Boolean) —

    The include_credentials



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

def include_credentials
  @properties['include_credentials']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



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

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

Returns The links.

Returns:

  • (String) —

    The links



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

def links
  @properties['links']
end

#sid ⇒ String

Returns The sid.

Returns:

  • (String) —

    The sid



358
359
360
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 358

def sid
  @properties['sid']
end

#to_s ⇒ Object

Provide a user friendly representation



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

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

#unique_name ⇒ String

Returns The unique_name.

Returns:

  • (String) —

    The unique_name



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

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) —

    The include_credentials

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

    The friendly_name

Returns:



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

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

#url ⇒ String

Returns The url.

Returns:

  • (String) —

    The url



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

def url
  @properties['url']
end