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 unique SID identifier of the Service for this Environment.

  • sid (String) (defaults to: nil)

    The unique SID identifier of this Environment.



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 284

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 Account Sid.

Returns:

  • (String)

    Account Sid.



326
327
328
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 326

def 
  @properties['account_sid']
end

#build_sidString

Returns Build Sid.

Returns:

  • (String)

    Build Sid.



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

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:



311
312
313
314
315
316
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 311

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

#date_createdTime

Returns The date that this Environment was created.

Returns:

  • (Time)

    The date that this Environment was created.



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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date that this Environment was updated.

Returns:

  • (Time)

    The date that this Environment was updated.



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

def date_updated
  @properties['date_updated']
end

#deploymentsdeployments

Access the deployments

Returns:



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

def deployments
  context.deployments
end

#domain_nameString

Returns The base domain name for all Functions and Assets deployed in this Environment.

Returns:

  • (String)

    The base domain name for all Functions and Assets deployed in this Environment.



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

def domain_name
  @properties['domain_name']
end

#domain_suffixString

Returns A URL-friendly name that represents this Environment.

Returns:

  • (String)

    A URL-friendly name that represents this Environment.



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

def domain_suffix
  @properties['domain_suffix']
end

#fetchEnvironmentInstance

Fetch a EnvironmentInstance

Returns:



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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

Returns Nested resource URLs.

Returns:

  • (String)

    Nested resource URLs.



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

def links
  @properties['links']
end

#service_sidString

Returns Service Sid.

Returns:

  • (String)

    Service Sid.



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

def service_sid
  @properties['service_sid']
end

#sidString

Returns Environment Sid.

Returns:

  • (String)

    Environment Sid.



320
321
322
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 320

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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

#unique_nameString

Returns A unique, addressable name of this Environment.

Returns:

  • (String)

    A unique, addressable name of this Environment.



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

def unique_name
  @properties['unique_name']
end

#urlString

Returns The URL of this Environment.

Returns:

  • (String)

    The URL of this Environment.



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

def url
  @properties['url']
end

#variablesvariables

Access the variables

Returns:



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

def variables
  context.variables
end