Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::EventContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, workspace_sid, sid) ⇒ EventContext

Initialize the EventContext

Parameters:

  • version (Version)

    Version that contains the resource

  • workspace_sid (String)

    The SID of the Workspace with the Event to fetch.

  • sid (String)

    The SID of the Event resource to fetch.



250
251
252
253
254
255
256
257
258
259
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 250

def initialize(version, workspace_sid, sid)
    super(version)
    

    # Path Solution
    @solution = { workspace_sid: workspace_sid, sid: sid,  }
    @uri = "/Workspaces/#{@solution[:workspace_sid]}/Events/#{@solution[:sid]}"

    
end

Instance Method Details

#fetchEventInstance

Fetch the EventInstance

Returns:



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 263

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    EventInstance.new(
        @version,
        payload,
        workspace_sid: @solution[:workspace_sid],
        sid: @solution[:sid],
    )
end

#fetch_with_metadataEventInstance

Fetch the EventInstanceMetadata

Returns:



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 283

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    event_instance = EventInstance.new(
        @version,
        response.body,
        workspace_sid: @solution[:workspace_sid],
        sid: @solution[:sid],
    )
    .new(
        @version,
        event_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



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

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Taskrouter.V1.EventContext #{context}>"
end

#to_sObject

Provide a user friendly representation



309
310
311
312
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 309

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Taskrouter.V1.EventContext #{context}>"
end