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



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 130

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



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

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:



151
152
153
154
155
156
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 151

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



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

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:



208
209
210
211
212
213
214
215
216
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb', line 208

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



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

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

#realtimeHash

Returns The realtime.

Returns:

  • (Hash)

    The realtime



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

def realtime
  @properties['realtime']
end

#to_sObject

Provide a user friendly representation



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

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



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

def url
  @properties['url']
end

#workspace_sidString

Returns The workspace_sid.

Returns:

  • (String)

    The workspace_sid



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

def workspace_sid
  @properties['workspace_sid']
end