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.



205
206
207
208
209
210
211
212
213
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 205

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:



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 217

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

#inspectObject

Provide a detailed, user friendly representation



244
245
246
247
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 244

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

#to_sObject

Provide a user friendly representation



237
238
239
240
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb', line 237

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