## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / module Twilio module REST class Taskrouter < Domain class V1 < Version class WorkspaceContext < InstanceContext class TaskQueueContext < InstanceContext class TaskQueueStatisticsList < ListResource ## # Initialize the TaskQueueStatisticsList # @param [Version] version Version that contains the resource # @param [String] workspace_sid The workspace_sid # @param [String] task_queue_sid The task_queue_sid # @return [TaskQueueStatisticsList] TaskQueueStatisticsList def initialize(version, workspace_sid: nil, task_queue_sid: nil) super(version) # Path Solution @solution = { workspace_sid: workspace_sid, task_queue_sid: task_queue_sid } end ## # Provide a user friendly representation def to_s '#' end end class TaskQueueStatisticsPage < Page ## # Initialize the TaskQueueStatisticsPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @param [String] workspace_sid The workspace_sid # @param [String] task_queue_sid The task_queue_sid # @return [TaskQueueStatisticsPage] TaskQueueStatisticsPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of TaskQueueStatisticsInstance # @param [Hash] payload Payload response from the API # @return [TaskQueueStatisticsInstance] TaskQueueStatisticsInstance def get_instance(payload) TaskQueueStatisticsInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], task_queue_sid: @solution[:task_queue_sid], ) end ## # Provide a user friendly representation def to_s '' end end class TaskQueueStatisticsContext < InstanceContext ## # Initialize the TaskQueueStatisticsContext # @param [Version] version Version that contains the resource # @param [String] workspace_sid The workspace_sid # @param [String] task_queue_sid The task_queue_sid # @return [TaskQueueStatisticsContext] TaskQueueStatisticsContext def initialize(version, workspace_sid, task_queue_sid) super(version) # Path Solution @solution = { workspace_sid: workspace_sid, task_queue_sid: task_queue_sid, } @uri = "/Workspaces/#{@solution[:workspace_sid]}/TaskQueues/#{@solution[:task_queue_sid]}/Statistics" end ## # Fetch a TaskQueueStatisticsInstance # @param [Time] end_date The end_date # @param [String] minutes The minutes # @param [Time] start_date The start_date # @return [TaskQueueStatisticsInstance] Fetched TaskQueueStatisticsInstance def fetch(end_date: :unset, minutes: :unset, start_date: :unset) params = Twilio::Values.of({ 'EndDate' => Twilio.serialize_iso8601(end_date), 'Minutes' => minutes, 'StartDate' => Twilio.serialize_iso8601(start_date), }) payload = @version.fetch( 'GET', @uri, params, ) TaskQueueStatisticsInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], task_queue_sid: @solution[:task_queue_sid], ) end ## # Provide a user friendly representation def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#" end end class TaskQueueStatisticsInstance < InstanceResource ## # Initialize the TaskQueueStatisticsInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] workspace_sid The workspace_sid # @param [String] task_queue_sid The task_queue_sid # @return [TaskQueueStatisticsInstance] TaskQueueStatisticsInstance def initialize(version, payload, workspace_sid: nil, task_queue_sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'cumulative' => payload['cumulative'], 'realtime' => payload['realtime'], 'task_queue_sid' => payload['task_queue_sid'], 'workspace_sid' => payload['workspace_sid'], 'url' => payload['url'], } # Context @instance_context = nil @params = { 'workspace_sid' => workspace_sid, 'task_queue_sid' => task_queue_sid, } end ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @param [Version] version Version that contains the resource # @return [TaskQueueStatisticsContext] TaskQueueStatisticsContext for this TaskQueueStatisticsInstance def context unless @instance_context @instance_context = TaskQueueStatisticsContext.new( @version, @params['workspace_sid'], @params['task_queue_sid'], ) end @instance_context end def account_sid @properties['account_sid'] end def cumulative @properties['cumulative'] end def realtime @properties['realtime'] end def task_queue_sid @properties['task_queue_sid'] end def workspace_sid @properties['workspace_sid'] end def url @properties['url'] end ## # Fetch a TaskQueueStatisticsInstance # @param [Time] end_date The end_date # @param [String] minutes The minutes # @param [Time] start_date The start_date # @return [TaskQueueStatisticsInstance] Fetched TaskQueueStatisticsInstance def fetch(end_date: :unset, minutes: :unset, start_date: :unset) context.fetch( end_date: end_date, minutes: minutes, start_date: start_date, ) end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "" end end end end end end end end