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

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The sid



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 227

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

Returns The account_sid.

Returns:

  • (String)

    The account_sid



266
267
268
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 266

def 
  @properties['account_sid']
end

#actor_sidString

Returns The actor_sid.

Returns:

  • (String)

    The actor_sid



272
273
274
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 272

def actor_sid
  @properties['actor_sid']
end

#actor_typeString

Returns The actor_type.

Returns:

  • (String)

    The actor_type



278
279
280
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 278

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

Returns:



257
258
259
260
261
262
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 257

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

#descriptionString

Returns The description.

Returns:

  • (String)

    The description



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

def description
  @properties['description']
end

#event_dataHash

Returns The event_data.

Returns:

  • (Hash)

    The event_data



290
291
292
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 290

def event_data
  @properties['event_data']
end

#event_dateTime

Returns The event_date.

Returns:

  • (Time)

    The event_date



296
297
298
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 296

def event_date
  @properties['event_date']
end

#event_typeString

Returns The event_type.

Returns:

  • (String)

    The event_type



302
303
304
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 302

def event_type
  @properties['event_type']
end

#fetchEventInstance

Fetch a EventInstance

Returns:



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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

Returns The links.

Returns:

  • (String)

    The links



344
345
346
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 344

def links
  @properties['links']
end

#resource_sidString

Returns The resource_sid.

Returns:

  • (String)

    The resource_sid



308
309
310
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 308

def resource_sid
  @properties['resource_sid']
end

#resource_typeString

Returns The resource_type.

Returns:

  • (String)

    The resource_type



314
315
316
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 314

def resource_type
  @properties['resource_type']
end

#sidString

Returns The sid.

Returns:

  • (String)

    The sid



320
321
322
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 320

def sid
  @properties['sid']
end

#sourceString

Returns The source.

Returns:

  • (String)

    The source



326
327
328
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 326

def source
  @properties['source']
end

#source_ip_addressString

Returns The source_ip_address.

Returns:

  • (String)

    The source_ip_address



332
333
334
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 332

def source_ip_address
  @properties['source_ip_address']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString

Returns The url.

Returns:

  • (String)

    The url



338
339
340
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 338

def url
  @properties['url']
end