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.



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 239

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_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Log resource.

Returns:



282
283
284
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 282

def 
    @properties['account_sid']
end

#build_sidString

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

Returns:

  • (String)

    The SID of the build that corresponds to the log.



300
301
302
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 300

def build_sid
    @properties['build_sid']
end

#contextLogContext

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



267
268
269
270
271
272
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 267

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

#date_createdTime

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

Returns:



336
337
338
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 336

def date_created
    @properties['date_created']
end

#deployment_sidString

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

Returns:

  • (String)

    The SID of the deployment that corresponds to the log.



306
307
308
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 306

def deployment_sid
    @properties['deployment_sid']
end

#environment_sidString

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

Returns:

  • (String)

    The SID of the environment in which the log occurred.



294
295
296
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 294

def environment_sid
    @properties['environment_sid']
end

#fetchLogInstance

Fetch the LogInstance

Returns:



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

def fetch

    context.fetch
end

#function_sidString

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

Returns:

  • (String)

    The SID of the function whose invocation produced the log.



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

def function_sid
    @properties['function_sid']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#levelLevel

Returns:

  • (Level)


324
325
326
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 324

def level
    @properties['level']
end

#messageString

Returns The log message.

Returns:

  • (String)

    The log message.



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

def message
    @properties['message']
end

#request_sidString

Returns The SID of the request associated with the log.

Returns:

  • (String)

    The SID of the request associated with the log.



318
319
320
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 318

def request_sid
    @properties['request_sid']
end

#service_sidString

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.



288
289
290
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 288

def service_sid
    @properties['service_sid']
end

#sidString

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.



276
277
278
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 276

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString

Returns The absolute URL of the Log resource.

Returns:

  • (String)

    The absolute URL of the Log resource.



342
343
344
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb', line 342

def url
    @properties['url']
end