lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb in twilio-ruby-5.0.0.rc13 vs lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb in twilio-ruby-5.0.0.rc14

- old
+ new

@@ -259,10 +259,11 @@ } @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workers/#{@solution[:sid]}" # Dependents @statistics = nil + @reservations = nil end ## # Fetch a WorkerInstance # @return [WorkerInstance] Fetched WorkerInstance @@ -327,10 +328,34 @@ @solution[:sid], ) end ## + # Access the reservations + # @return [ReservationList] ReservationList + def reservations(sid=:unset) + if sid != :unset + return ReservationContext.new( + @version, + @solution[:workspace_sid], + @solution[:sid], + sid, + ) + end + + unless @reservations + @reservations = ReservationList.new( + @version, + workspace_sid: @solution[:workspace_sid], + worker_sid: @solution[:sid], + ) + end + + @reservations + end + + ## # Provide a user friendly representation def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.WorkerContext #{context}>" end @@ -461,9 +486,16 @@ ## # Access the statistics # @return [statistics] statistics def statistics context.statistics + end + + ## + # Access the reservations + # @return [reservations] reservations + def reservations + context.reservations end ## # Provide a user friendly representation def to_s \ No newline at end of file