Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::EventInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb

Instance Method Summary collapse

Constructor Details

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

Initialize the EventInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • workspace_sid (String) (defaults to: nil)

    The sid

  • sid (String) (defaults to: nil)

    The sid



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 249

def initialize(version, payload, workspace_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'actor_sid' => payload['actor_sid'],
      'actor_type' => payload['actor_type'],
      'actor_url' => payload['actor_url'],
      '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'],
      'resource_url' => payload['resource_url'],
      'sid' => payload['sid'],
      'source' => payload['source'],
      'source_ip_address' => payload['source_ip_address'],
      'url' => payload['url'],
  }

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

Instance Method Details

#account_sidString

Returns The account_sid.

Returns:

  • (String)

    The account_sid



289
290
291
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 289

def 
  @properties['account_sid']
end

#actor_sidString

Returns The actor_sid.

Returns:

  • (String)

    The actor_sid



295
296
297
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 295

def actor_sid
  @properties['actor_sid']
end

#actor_typeString

Returns The actor_type.

Returns:

  • (String)

    The actor_type



301
302
303
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 301

def actor_type
  @properties['actor_type']
end

#actor_urlString

Returns The actor_url.

Returns:

  • (String)

    The actor_url



307
308
309
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 307

def actor_url
  @properties['actor_url']
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:



280
281
282
283
284
285
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 280

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

#descriptionString

Returns The description.

Returns:

  • (String)

    The description



313
314
315
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 313

def description
  @properties['description']
end

#event_dataString

Returns The event_data.

Returns:

  • (String)

    The event_data



319
320
321
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 319

def event_data
  @properties['event_data']
end

#event_dateTime

Returns The event_date.

Returns:

  • (Time)

    The event_date



325
326
327
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 325

def event_date
  @properties['event_date']
end

#event_typeString

Returns The event_type.

Returns:

  • (String)

    The event_type



331
332
333
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 331

def event_type
  @properties['event_type']
end

#fetchEventInstance

Fetch a EventInstance

Returns:



380
381
382
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 380

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



393
394
395
396
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 393

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

#resource_sidString

Returns The resource_sid.

Returns:

  • (String)

    The resource_sid



337
338
339
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 337

def resource_sid
  @properties['resource_sid']
end

#resource_typeString

Returns The resource_type.

Returns:

  • (String)

    The resource_type



343
344
345
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 343

def resource_type
  @properties['resource_type']
end

#resource_urlString

Returns The resource_url.

Returns:

  • (String)

    The resource_url



349
350
351
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 349

def resource_url
  @properties['resource_url']
end

#sidString

Returns The sid.

Returns:

  • (String)

    The sid



355
356
357
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 355

def sid
  @properties['sid']
end

#sourceString

Returns The source.

Returns:

  • (String)

    The source



361
362
363
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 361

def source
  @properties['source']
end

#source_ip_addressString

Returns The source_ip_address.

Returns:

  • (String)

    The source_ip_address



367
368
369
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 367

def source_ip_address
  @properties['source_ip_address']
end

#to_sObject

Provide a user friendly representation



386
387
388
389
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 386

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

#urlString

Returns The url.

Returns:

  • (String)

    The url



373
374
375
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 373

def url
  @properties['url']
end