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

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/serverless/v1/service/environment.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, 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

  • service_sid (String) (defaults to: nil)

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

  • sid (String) (defaults to: nil)

    The SID of the Environment resource to fetch.



303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 303

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, 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the Environment resource.

Returns:

  • (String)

    The SID of the Account that created the Environment resource



345
346
347
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 345

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



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

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:



330
331
332
333
334
335
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 330

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

#date_createdTime

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

Returns:

  • (Time)

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



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

def date_created
  @properties['date_created']
end

#date_updatedTime

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

Returns:

  • (Time)

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



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the EnvironmentInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



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

def delete
  context.delete
end

#deploymentsdeployments

Access the deployments

Returns:



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

def deployments
  context.deployments
end

#domain_nameString

Returns The base domain name for all Functions and Assets deployed in the environment.

Returns:

  • (String)

    The base domain name for all Functions and Assets deployed in the environment



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

def domain_name
  @properties['domain_name']
end

#domain_suffixString

Returns A URL-friendly name that represents the environment.

Returns:

  • (String)

    A URL-friendly name that represents the environment



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

def domain_suffix
  @properties['domain_suffix']
end

#fetchEnvironmentInstance

Fetch the EnvironmentInstance

Returns:



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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

Returns The URLs of the environment’s nested resources.

Returns:

  • (String)

    The URLs of the environment’s nested resources



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

def links
  @properties['links']
end

#logslogs

Access the logs

Returns:



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

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



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

def service_sid
  @properties['service_sid']
end

#sidString

Returns The unique string that identifies the Environment resource.

Returns:

  • (String)

    The unique string that identifies the Environment resource



339
340
341
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 339

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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

#unique_nameString

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

Returns:

  • (String)

    An application-defined string that uniquely identifies the Environment resource



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

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



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

def url
  @properties['url']
end

#variablesvariables

Access the variables

Returns:



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

def variables
  context.variables
end