Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkspaceStatisticsInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, workspace_sid: nil) ⇒ WorkspaceStatisticsInstance

Initialize the WorkspaceStatisticsInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • workspace_sid (String) (defaults to: nil)

    The workspace_sid



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 137

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

  # Marshaled Properties
  @properties = {
      'realtime' => payload['realtime'],
      'cumulative' => payload['cumulative'],
      'account_sid' => payload['account_sid'],
      'workspace_sid' => payload['workspace_sid'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {'workspace_sid' => workspace_sid, }
end

Instance Method Details

#account_sidString

Returns The account_sid.

Returns:

  • (String)

    The account_sid



179
180
181
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 179

def 
  @properties['account_sid']
end

#contextWorkspaceStatisticsContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



158
159
160
161
162
163
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 158

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

#cumulativeHash

Returns The cumulative.

Returns:

  • (Hash)

    The cumulative



173
174
175
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 173

def cumulative
  @properties['cumulative']
end

#fetch(minutes: :unset, start_date: :unset, end_date: :unset, task_channel: :unset, split_by_wait_time: :unset) ⇒ WorkspaceStatisticsInstance

Fetch a WorkspaceStatisticsInstance

Parameters:

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

    Filter cumulative statistics by up to ‘x’ minutes in the past. This is helpful for statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. Defaults to 15 minutes.

  • start_date (Time) (defaults to: :unset)

    Filter cumulative statistics by a start date. This is helpful for defining a range of statistics to capture. Input is a GMT ISO 8601 Timestamp

  • end_date (Time) (defaults to: :unset)

    Filter cumulative statistics by an end date. This is helpful for defining a range of statistics to capture. Input is a GMT ISO 8601 Timestamp

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

    Filter real-time and cumulative statistics by TaskChannel. Takes in a Unique Name (“voice”, “sms”, “default”, etc.) or a TaskChannelSid.

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

    A comma separated values for viewing splits of tasks canceled and accepted above the given threshold in seconds. Ex: “5,30” would show splits of tasks that were canceled or accepted before or after 5 seconds and respectively, 30 seconds. This is great for showing short abandoned tasks or tasks that failed to meet your SLA.

Returns:



215
216
217
218
219
220
221
222
223
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 215

def fetch(minutes: :unset, start_date: :unset, end_date: :unset, task_channel: :unset, split_by_wait_time: :unset)
  context.fetch(
      minutes: minutes,
      start_date: start_date,
      end_date: end_date,
      task_channel: task_channel,
      split_by_wait_time: split_by_wait_time,
  )
end

#inspectObject

Provide a detailed, user friendly representation



234
235
236
237
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 234

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

#realtimeHash

Returns The realtime.

Returns:

  • (Hash)

    The realtime



167
168
169
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 167

def realtime
  @properties['realtime']
end

#to_sObject

Provide a user friendly representation



227
228
229
230
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 227

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

#urlString

Returns The url.

Returns:

  • (String)

    The url



191
192
193
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 191

def url
  @properties['url']
end

#workspace_sidString

Returns The workspace_sid.

Returns:

  • (String)

    The workspace_sid



185
186
187
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 185

def workspace_sid
  @properties['workspace_sid']
end