Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkspaceRealTimeStatisticsContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, workspace_sid) ⇒ WorkspaceRealTimeStatisticsContext

Initialize the WorkspaceRealTimeStatisticsContext

Parameters:

  • version (Version)

    Version that contains the resource

  • workspace_sid (String)

    The SID of the Workspace to fetch.



51
52
53
54
55
56
57
58
59
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_real_time_statistics.rb', line 51

def initialize(version, workspace_sid)
    super(version)

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

    
end

Instance Method Details

#fetch(task_channel: :unset) ⇒ WorkspaceRealTimeStatisticsInstance

Fetch the WorkspaceRealTimeStatisticsInstance

Parameters:

  • task_channel (String) (defaults to: :unset)

    Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel’s SID or its ‘unique_name`, such as `voice`, `sms`, or `default`.

Returns:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_real_time_statistics.rb', line 64

def fetch(
    task_channel: :unset
)

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

#inspectObject

Provide a detailed, user friendly representation



95
96
97
98
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_real_time_statistics.rb', line 95

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

#to_sObject

Provide a user friendly representation



88
89
90
91
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_real_time_statistics.rb', line 88

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