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



423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 423

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



463
464
465
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 463

def 
    @properties['account_sid']
end

#actor_sidString



469
470
471
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 469

def actor_sid
    @properties['actor_sid']
end

#actor_typeString



475
476
477
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 475

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



454
455
456
457
458
459
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 454

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

#descriptionString



481
482
483
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 481

def description
    @properties['description']
end

#event_dataHash



487
488
489
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 487

def event_data
    @properties['event_data']
end

#event_dateTime



493
494
495
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 493

def event_date
    @properties['event_date']
end

#event_typeString



499
500
501
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 499

def event_type
    @properties['event_type']
end

#fetchEventInstance

Fetch the EventInstance



548
549
550
551
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 548

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



562
563
564
565
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 562

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


541
542
543
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 541

def links
    @properties['links']
end

#resource_sidString



505
506
507
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 505

def resource_sid
    @properties['resource_sid']
end

#resource_typeString



511
512
513
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 511

def resource_type
    @properties['resource_type']
end

#sidString



517
518
519
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 517

def sid
    @properties['sid']
end

#sourceString



523
524
525
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 523

def source
    @properties['source']
end

#source_ip_addressString



529
530
531
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 529

def source_ip_address
    @properties['source_ip_address']
end

#to_sObject

Provide a user friendly representation



555
556
557
558
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 555

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

#urlString



535
536
537
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 535

def url
    @properties['url']
end