Class: Twilio::REST::Serverless::V1::ServiceContext::EnvironmentInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, sid: nil) ⇒ EnvironmentInstance

Initialize the EnvironmentInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



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

def initialize(version, payload , service_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'service_sid' => payload['service_sid'],
        'build_sid' => payload['build_sid'],
        'unique_name' => payload['unique_name'],
        'domain_suffix' => payload['domain_suffix'],
        'domain_name' => payload['domain_name'],
        '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 = { 'service_sid' => service_sid  || @properties['service_sid']  ,'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 Environment resource.

Returns:



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

def 
    @properties['account_sid']
end

#build_sidString

Returns The SID of the build deployed in the environment.

Returns:

  • (String)

    The SID of the build deployed in the environment.



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

def build_sid
    @properties['build_sid']
end

#contextEnvironmentContext

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

Returns:



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

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

#date_createdTime

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

Returns:



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

def date_created
    @properties['date_created']
end

#date_updatedTime

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

Returns:



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

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the EnvironmentInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#deploymentsdeployments

Access the deployments

Returns:



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

def deployments
    context.deployments
end

#domain_nameString

Returns The domain name for all Functions and Assets deployed in the Environment, using the Service unique name, a randomly-generated Service suffix, and an optional Environment domain suffix.

Returns:

  • (String)

    The domain name for all Functions and Assets deployed in the Environment, using the Service unique name, a randomly-generated Service suffix, and an optional Environment domain suffix.



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

def domain_name
    @properties['domain_name']
end

#domain_suffixString

Returns A URL-friendly name that represents the environment and forms part of the domain name.

Returns:

  • (String)

    A URL-friendly name that represents the environment and forms part of the domain name.



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

def domain_suffix
    @properties['domain_suffix']
end

#fetchEnvironmentInstance

Fetch the EnvironmentInstance

Returns:



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

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



469
470
471
472
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 469

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

Returns The URLs of the Environment resource’s nested resources.

Returns:

  • (Hash)

    The URLs of the Environment resource’s nested resources.



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

def links
    @properties['links']
end

#logslogs

Access the logs

Returns:



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

def logs
    context.logs
end

#service_sidString

Returns The SID of the Service that the Environment resource is associated with.

Returns:

  • (String)

    The SID of the Service that the Environment resource is associated with.



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

def service_sid
    @properties['service_sid']
end

#sidString

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

Returns:

  • (String)

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



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

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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

#unique_nameString

Returns A user-defined string that uniquely identifies the Environment resource.

Returns:

  • (String)

    A user-defined string that uniquely identifies the Environment resource.



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

def unique_name
    @properties['unique_name']
end

#urlString

Returns The absolute URL of the Environment resource.

Returns:

  • (String)

    The absolute URL of the Environment resource.



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

def url
    @properties['url']
end

#variablesvariables

Access the variables

Returns:



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

def variables
    context.variables
end