Class: Twilio::REST::Serverless::V1::ServiceContext::EnvironmentContext::LogInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the LogInstance

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

  • sid (String) (defaults to: nil) —

    The SID of the Call resource to fetch.



416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 416

def initialize(version, payload , service_sid: nil, environment_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'service_sid' => payload['service_sid'],
        'environment_sid' => payload['environment_sid'],
        'build_sid' => payload['build_sid'],
        'deployment_sid' => payload['deployment_sid'],
        'function_sid' => payload['function_sid'],
        'request_sid' => payload['request_sid'],
        'level' => payload['level'],
        'message' => payload['message'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'service_sid' => service_sid  || @properties['service_sid']  ,'environment_sid' => environment_sid  || @properties['environment_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sid ⇒ String

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

Returns:

  • (String) —

    The SID of the Account that created the Log resource.



460
461
462
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 460

def 
    @properties['account_sid']
end

#build_sid ⇒ String

Returns The SID of the build that corresponds to the log.

Returns:

  • (String) —

    The SID of the build that corresponds to the log.



478
479
480
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 478

def build_sid
    @properties['build_sid']
end

#context ⇒ LogContext

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

Returns:

  • (LogContext) —

    CallContext for this CallInstance



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

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

#date_created ⇒ Time

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

Returns:

  • (Time) —

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



514
515
516
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 514

def date_created
    @properties['date_created']
end

#deployment_sid ⇒ String

Returns The SID of the deployment that corresponds to the log.

Returns:

  • (String) —

    The SID of the deployment that corresponds to the log.



484
485
486
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 484

def deployment_sid
    @properties['deployment_sid']
end

#environment_sid ⇒ String

Returns The SID of the environment in which the log occurred.

Returns:

  • (String) —

    The SID of the environment in which the log occurred.



472
473
474
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 472

def environment_sid
    @properties['environment_sid']
end

#fetch ⇒ LogInstance

Fetch the LogInstance

Returns:



527
528
529
530
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 527

def fetch

    context.fetch
end

#function_sid ⇒ String

Returns The SID of the function whose invocation produced the log.

Returns:

  • (String) —

    The SID of the function whose invocation produced the log.



490
491
492
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 490

def function_sid
    @properties['function_sid']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



541
542
543
544
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 541

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

#level ⇒ String

Returns The log level.

Returns:

  • (String) —

    The log level.



502
503
504
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 502

def level
    @properties['level']
end

#message ⇒ String

Returns The log message.

Returns:

  • (String) —

    The log message.



508
509
510
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 508

def message
    @properties['message']
end

#request_sid ⇒ String

Returns The SID of the request associated with the log.

Returns:

  • (String) —

    The SID of the request associated with the log.



496
497
498
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 496

def request_sid
    @properties['request_sid']
end

#service_sid ⇒ String

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

Returns:

  • (String) —

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



466
467
468
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 466

def service_sid
    @properties['service_sid']
end

#sid ⇒ String

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

Returns:

  • (String) —

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



454
455
456
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 454

def sid
    @properties['sid']
end

#to_s ⇒ Object

Provide a user friendly representation



534
535
536
537
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 534

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

#url ⇒ String

Returns The absolute URL of the Log resource.

Returns:

  • (String) —

    The absolute URL of the Log resource.



520
521
522
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 520

def url
    @properties['url']
end