## # This code was generated by # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # # Twilio - Taskrouter # This is the public Twilio REST API. # # NOTE: This class is auto generated by OpenAPI Generator. # https://openapi-generator.tech # Do not edit the class manually. # module Twilio module REST class Taskrouter < TaskrouterBase class V1 < Version class WorkspaceContext < InstanceContext class WorkerContext < InstanceContext class WorkersRealTimeStatisticsList < ListResource ## # Initialize the WorkersRealTimeStatisticsList # @param [Version] version Version that contains the resource # @return [WorkersRealTimeStatisticsList] WorkersRealTimeStatisticsList def initialize(version, workspace_sid: nil) super(version) # Path Solution @solution = { workspace_sid: workspace_sid } end # Provide a user friendly representation def to_s '#' end end class WorkersRealTimeStatisticsContext < InstanceContext ## # Initialize the WorkersRealTimeStatisticsContext # @param [Version] version Version that contains the resource # @param [String] workspace_sid The SID of the Workspace with the resource to fetch. # @return [WorkersRealTimeStatisticsContext] WorkersRealTimeStatisticsContext def initialize(version, workspace_sid) super(version) # Path Solution @solution = { workspace_sid: workspace_sid, } @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workers/RealTimeStatistics" end ## # Fetch the WorkersRealTimeStatisticsInstance # @param [String] task_channel Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. # @return [WorkersRealTimeStatisticsInstance] Fetched WorkersRealTimeStatisticsInstance def fetch( task_channel: :unset ) params = Twilio::Values.of({ 'TaskChannel' => task_channel, }) payload = @version.fetch('GET', @uri, params: params) WorkersRealTimeStatisticsInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], ) end ## # Provide a user friendly representation def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#" end ## # Provide a detailed, user friendly representation def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#" end end class WorkersRealTimeStatisticsPage < Page ## # Initialize the WorkersRealTimeStatisticsPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [WorkersRealTimeStatisticsPage] WorkersRealTimeStatisticsPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of WorkersRealTimeStatisticsInstance # @param [Hash] payload Payload response from the API # @return [WorkersRealTimeStatisticsInstance] WorkersRealTimeStatisticsInstance def get_instance(payload) WorkersRealTimeStatisticsInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid]) end ## # Provide a user friendly representation def to_s '' end end class WorkersRealTimeStatisticsInstance < InstanceResource ## # Initialize the WorkersRealTimeStatisticsInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] account_sid The SID of the # {Account}[https://www.twilio.com/docs/iam/api/account] that created this WorkersRealTimeStatistics # resource. # @param [String] sid The SID of the Call resource to fetch. # @return [WorkersRealTimeStatisticsInstance] WorkersRealTimeStatisticsInstance def initialize(version, payload , workspace_sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'activity_statistics' => payload['activity_statistics'], 'total_workers' => payload['total_workers'] == nil ? payload['total_workers'] : payload['total_workers'].to_i, 'workspace_sid' => payload['workspace_sid'], 'url' => payload['url'], } # Context @instance_context = nil @params = { 'workspace_sid' => workspace_sid || @properties['workspace_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 # @return [WorkersRealTimeStatisticsContext] CallContext for this CallInstance def context unless @instance_context @instance_context = WorkersRealTimeStatisticsContext.new(@version , @params['workspace_sid']) end @instance_context end ## # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. def account_sid @properties['account_sid'] end ## # @return [Array] The number of current Workers by Activity. def activity_statistics @properties['activity_statistics'] end ## # @return [String] The total number of Workers. def total_workers @properties['total_workers'] end ## # @return [String] The SID of the Workspace that contains the Workers. def workspace_sid @properties['workspace_sid'] end ## # @return [String] The absolute URL of the Workers statistics resource. def url @properties['url'] end ## # Fetch the WorkersRealTimeStatisticsInstance # @param [String] task_channel Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. # @return [WorkersRealTimeStatisticsInstance] Fetched WorkersRealTimeStatisticsInstance def fetch( task_channel: :unset ) context.fetch( task_channel: task_channel, ) end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "" end ## # Provide a detailed, user friendly representation def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "" end end end end end end end end