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.



544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 544

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

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

Returns:

  • (String) —

    The SID of the Account that created the Environment resource.



587
588
589
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 587

def 
    @properties['account_sid']
end

#build_sid ⇒ String

Returns The SID of the build deployed in the environment.

Returns:

  • (String) —

    The SID of the build deployed in the environment.



599
600
601
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 599

def build_sid
    @properties['build_sid']
end

#context ⇒ EnvironmentContext

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

Returns:



572
573
574
575
576
577
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 572

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

#date_created ⇒ Time

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

Returns:

  • (Time) —

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



623
624
625
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 623

def date_created
    @properties['date_created']
end

#date_updated ⇒ Time

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

Returns:

  • (Time) —

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



629
630
631
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 629

def date_updated
    @properties['date_updated']
end

#delete ⇒ Boolean

Delete the EnvironmentInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



648
649
650
651
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 648

def delete

    context.delete
end

#deployments ⇒ deployments

Access the deployments

Returns:



678
679
680
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 678

def deployments
    context.deployments
end

#domain_name ⇒ String

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.



617
618
619
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 617

def domain_name
    @properties['domain_name']
end

#domain_suffix ⇒ String

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.



611
612
613
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 611

def domain_suffix
    @properties['domain_suffix']
end

#fetch ⇒ EnvironmentInstance

Fetch the EnvironmentInstance

Returns:



656
657
658
659
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 656

def fetch

    context.fetch
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



691
692
693
694
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 691

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.



641
642
643
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 641

def links
    @properties['links']
end

#logs ⇒ logs

Access the logs

Returns:



664
665
666
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 664

def logs
    context.logs
end

#service_sid ⇒ String

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.



593
594
595
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 593

def service_sid
    @properties['service_sid']
end

#sid ⇒ String

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.



581
582
583
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 581

def sid
    @properties['sid']
end

#to_s ⇒ Object

Provide a user friendly representation



684
685
686
687
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 684

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

#unique_name ⇒ String

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

Returns:

  • (String) —

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



605
606
607
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 605

def unique_name
    @properties['unique_name']
end

#url ⇒ String

Returns The absolute URL of the Environment resource.

Returns:

  • (String) —

    The absolute URL of the Environment resource.



635
636
637
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 635

def url
    @properties['url']
end

#variables ⇒ variables

Access the variables

Returns:



671
672
673
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 671

def variables
    context.variables
end