Class: Twilio::REST::Autopilot::V1::AssistantContext::TaskContext::TaskStatisticsInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, assistant_sid: nil, task_sid: nil) ⇒ TaskStatisticsInstance

Initialize the TaskStatisticsInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • assistant_sid (String) (defaults to: nil)

    The SID of the [Assistant](www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource.

  • task_sid (String) (defaults to: nil)

    The SID of the [Task](www.twilio.com/docs/autopilot/api/task) for which the statistics were collected.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb', line 148

def initialize(version, payload, assistant_sid: nil, task_sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'assistant_sid' => payload['assistant_sid'],
      'task_sid' => payload['task_sid'],
      'samples_count' => payload['samples_count'].to_i,
      'fields_count' => payload['fields_count'].to_i,
      'url' => payload['url'],
  }

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

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



183
184
185
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb', line 183

def 
  @properties['account_sid']
end

#assistant_sidString

Returns The SID of the Assistant that is the parent of the Task associated with the resource.

Returns:

  • (String)

    The SID of the Assistant that is the parent of the Task associated with the resource



189
190
191
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb', line 189

def assistant_sid
  @properties['assistant_sid']
end

#contextTaskStatisticsContext

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

Returns:



170
171
172
173
174
175
176
177
178
179
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb', line 170

def context
  unless @instance_context
    @instance_context = TaskStatisticsContext.new(
        @version,
        @params['assistant_sid'],
        @params['task_sid'],
    )
  end
  @instance_context
end

#fetchTaskStatisticsInstance

Fetch a TaskStatisticsInstance

Returns:



220
221
222
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb', line 220

def fetch
  context.fetch
end

#fields_countString

Returns The total number of Fields associated with the Task.

Returns:

  • (String)

    The total number of Fields associated with the Task



207
208
209
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb', line 207

def fields_count
  @properties['fields_count']
end

#inspectObject

Provide a detailed, user friendly representation



233
234
235
236
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb', line 233

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

#samples_countString

Returns The total number of Samples associated with the Task.

Returns:

  • (String)

    The total number of Samples associated with the Task



201
202
203
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb', line 201

def samples_count
  @properties['samples_count']
end

#task_sidString

Returns The SID of the Task for which the statistics were collected.

Returns:

  • (String)

    The SID of the Task for which the statistics were collected



195
196
197
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb', line 195

def task_sid
  @properties['task_sid']
end

#to_sObject

Provide a user friendly representation



226
227
228
229
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb', line 226

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

#urlString

Returns The absolute URL of the TaskStatistics resource.

Returns:

  • (String)

    The absolute URL of the TaskStatistics resource



213
214
215
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb', line 213

def url
  @properties['url']
end