Class: Twilio::REST::Monitor::V1::EventInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/monitor/v1/event.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ EventInstance

Initialize the EventInstance



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 254

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'actor_sid' => payload['actor_sid'],
        'actor_type' => payload['actor_type'],
        'description' => payload['description'],
        'event_data' => payload['event_data'],
        'event_date' => Twilio.deserialize_iso8601_datetime(payload['event_date']),
        'event_type' => payload['event_type'],
        'resource_sid' => payload['resource_sid'],
        'resource_type' => payload['resource_type'],
        'sid' => payload['sid'],
        'source' => payload['source'],
        'source_ip_address' => payload['source_ip_address'],
        'url' => payload['url'],
        'links' => payload['links'],
    }

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

Instance Method Details

#account_sidString



293
294
295
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 293

def 
    @properties['account_sid']
end

#actor_sidString



299
300
301
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 299

def actor_sid
    @properties['actor_sid']
end

#actor_typeString



305
306
307
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 305

def actor_type
    @properties['actor_type']
end

#contextEventContext

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



284
285
286
287
288
289
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 284

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

#descriptionString



311
312
313
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 311

def description
    @properties['description']
end

#event_dataHash



317
318
319
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 317

def event_data
    @properties['event_data']
end

#event_dateTime



323
324
325
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 323

def event_date
    @properties['event_date']
end

#event_typeString



329
330
331
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 329

def event_type
    @properties['event_type']
end

#fetchEventInstance

Fetch the EventInstance



378
379
380
381
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 378

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



392
393
394
395
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 392

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


371
372
373
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 371

def links
    @properties['links']
end

#resource_sidString



335
336
337
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 335

def resource_sid
    @properties['resource_sid']
end

#resource_typeString



341
342
343
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 341

def resource_type
    @properties['resource_type']
end

#sidString



347
348
349
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 347

def sid
    @properties['sid']
end

#sourceString



353
354
355
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 353

def source
    @properties['source']
end

#source_ip_addressString



359
360
361
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 359

def source_ip_address
    @properties['source_ip_address']
end

#to_sObject

Provide a user friendly representation



385
386
387
388
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 385

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

#urlString



365
366
367
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 365

def url
    @properties['url']
end