Ejemplo n.º 1
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        // To set up environmental variables, see http://twil.io/secure
        const string accountSid   = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        const string authToken    = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");
        const string workspaceSid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string WorkerSid    = "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

        TwilioClient.Init(accountSid, authToken);

        var worker = WorkerResource.Update(
            workspaceSid, WorkerSid, attributes: "{\"type\":\"support\"}");

        Console.WriteLine(worker.FriendlyName);
        Console.WriteLine(worker.Attributes);

        var attributes = JObject.Parse(worker.Attributes);

        attributes["type"] = "support";

        worker = WorkerResource.Update(workspaceSid, WorkerSid, attributes.ToString());

        Console.WriteLine(worker.FriendlyName);
        Console.WriteLine(worker.Attributes);
    }
Ejemplo n.º 2
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        // To set up environmental variables, see http://twil.io/secure
        const string accountSid   = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        const string authToken    = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");
        const string workspaceSid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string taskQueueSid = "WQf855e98ad280d0a0a325628e24ca9627";

        TwilioClient.Init(accountSid, authToken);

        var workers = WorkerResource.Read(workspaceSid, taskQueueSid);

        foreach (var worker in workers)
        {
            Console.WriteLine(worker.FriendlyName);
        }

        workers = WorkerResource.Read(
            workspaceSid, taskQueueSid,
            targetWorkersExpression: "type == 'leads'");

        foreach (var worker in workers)
        {
            Console.WriteLine(worker.FriendlyName);
        }
    }
        private void UpgradeTerraformAndAssertSuccess(Action beforeAction = null, WorkerResource expectedValue = null)
        {
            this.PerformActionAndAssertResult(true, () => new UpgradeTerraformAction(this.Player), beforeAction);

            this.Race.SpadeCost.Resources.FirstOrDefault(r => r.Name.Equals(WorkerResource.Key))
            .ShouldBeEquivalentTo(expectedValue ?? new WorkerResource(2));
        }
        private void UsePowerAbilityAndAssertSuccess(Action beforeAction = null, WorkerResource expectedValue = null)
        {
            var ability = new TestPowerAbility(this.Player);

            this.PerformActionAndAssertResult(true, () => new UsePowerAbilityAction(this.Player, ability), beforeAction);
            this.Player.TestHit.Should().BeTrue();
        }
Ejemplo n.º 5
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid   = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken    = "your_auth_token";
        const string workspaceSid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string WorkerSid    = "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

        TwilioClient.Init(accountSid, authToken);

        var worker = WorkerResource.Update(
            workspaceSid, WorkerSid, attributes: "{\"type\":\"support\"}");

        Console.WriteLine(worker.FriendlyName);
        Console.WriteLine(worker.Attributes);

        var attributes = JObject.Parse(worker.Attributes);

        attributes["type"] = "support";

        worker = WorkerResource.Update(workspaceSid, WorkerSid, attributes.ToString());

        Console.WriteLine(worker.FriendlyName);
        Console.WriteLine(worker.Attributes);
    }
Ejemplo n.º 6
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid   = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken    = "your_auth_token";
        const string workspaceSid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string taskQueueSid = "WQf855e98ad280d0a0a325628e24ca9627";

        TwilioClient.Init(accountSid, authToken);

        var workers = WorkerResource.Read(workspaceSid, taskQueueSid);

        foreach (var worker in workers)
        {
            Console.WriteLine(worker.FriendlyName);
        }

        workers = WorkerResource.Read(
            workspaceSid, taskQueueSid,
            targetWorkersExpression: "type == 'leads'");

        foreach (var worker in workers)
        {
            Console.WriteLine(worker.FriendlyName);
        }
    }
Ejemplo n.º 7
0
        private double getNeedTime(double overallEfficiency, int complexity)
        {
            foreach (Resource res in resources)
            {
                if (res is WorkerResource)
                {
                    WorkerResource worker       = res as WorkerResource;
                    bool           isUsedByThis = worker.users.Contains(this.id);

                    if (worker.users.Count == 0)
                    {
                        worker.isBusy = false;
                    }

                    if (worker.isBusy && !worker.isShared && !isUsedByThis)
                    {
                        return(Double.MaxValue);
                    }

                    if (worker.isBusy && worker.isShared || worker.isBusy && isUsedByThis)
                    {
                        if (!worker.users.Contains(this.id))
                        {
                            worker.users.Add(this.id);
                        }

                        overallEfficiency += processInstrumentalReesource(worker) * worker.efficiency * worker.count / (worker.users.Count > 0 ? worker.users.Count : 1);
                    }

                    if (!worker.isBusy)
                    {
                        overallEfficiency += worker.efficiency * worker.count;
                        if (!worker.users.Contains(this.id))
                        {
                            worker.users.Add(this.id);
                            worker.isBusy = true;
                        }
                    }

                    foreach (MaterialResource material in worker.materials)
                    {
                        processSingleMaterial(material);
                    }
                }

                if (res is MaterialResource)
                {
                    processSingleMaterial(res as MaterialResource);
                }

                if (res is InstrumentResource)
                {
                    overallEfficiency += processSingleInstrument(res as InstrumentResource);
                }
            }

            return(needTime = (1 / overallEfficiency) * manHour * complexity);
        }
Ejemplo n.º 8
0
        private double processInstrumentalReesource(WorkerResource worker)
        {
            double result = 1.0;

            foreach (InstrumentResource instrument in worker.instruments)
            {
                result += processSingleInstrument(instrument);
            }
            return(result == 1.0 ? result : result - 1.0);
        }
Ejemplo n.º 9
0
        private void processWorkerResources(WorkerResource wr)
        {
            processInstrumentResources(wr.instruments);
            processMaterialResources(wr.materials);

            if (workers.Contains(wr))
            {
                workers.Remove(wr);
            }
        }
Ejemplo n.º 10
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid   = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken    = "your_auth_token";
        const string workspaceSid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string workerSid    = "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

        TwilioClient.Init(accountSid, authToken);

        WorkerResource.Delete(workspaceSid, workerSid);
    }
Ejemplo n.º 11
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        // To set up environmental variables, see http://twil.io/secure
        const string accountSid   = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        const string authToken    = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");
        const string workspaceSid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string workerSid    = "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

        TwilioClient.Init(accountSid, authToken);

        WorkerResource.Delete(workspaceSid, workerSid);
    }
Ejemplo n.º 12
0
        public void AsIResourceTest()
        {
            // Arrange
            IResource resource1 = new WorkerResource();
            IResource resource2;

            // Act
            resource2 = SaveTester <IResource> .StartSaveTest(resource1);

            // Arranges
            Assert.AreEqual((resource1 as WorkerResource).Description, (resource2 as WorkerResource).Description);
            Assert.AreEqual((resource1 as WorkerResource).WorkerQualification, (resource2 as WorkerResource).WorkerQualification);
        }
Ejemplo n.º 13
0
        public void DefaultTest()
        {
            // Arrange
            WorkerResource resource1 = new WorkerResource();
            WorkerResource resource2;

            // Act
            resource2 = SaveTester <WorkerResource> .StartSaveTest(resource1);

            // Arranges
            Assert.AreEqual((resource1).Description, (resource2).Description);
            Assert.AreEqual((resource1).WorkerQualification, (resource2).WorkerQualification);
        }
Ejemplo n.º 14
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        // DANGER! This is insecure. See http://twil.io/secure
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken  = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        WorkerResource.Delete(
            pathWorkspaceSid: "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            pathSid: "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
            );
    }
Ejemplo n.º 15
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken  = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var worker = WorkerResource.Fetch(
            pathWorkspaceSid: "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            pathSid: "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
            );

        Console.WriteLine(worker.ActivityName);
    }
Ejemplo n.º 16
0
        public void TestCreateResponse()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();

            twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
            twilioRestClient.Request(Arg.Any <Request>())
            .Returns(new Response(
                         System.Net.HttpStatusCode.Created,
                         "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"activity_name\": \"available\",\"activity_sid\": \"WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": \"{\\\"email\\\": \\\"[email protected]\\\", \\\"phone\\\": \\\"8675309\\\"}\",\"available\": true,\"date_created\": \"2014-05-14T10:50:02Z\",\"date_status_changed\": \"2014-05-14T23:26:06Z\",\"date_updated\": \"2014-05-14T23:26:06Z\",\"friendly_name\": \"Test Worker\",\"sid\": \"WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"workspace_sid\": \"WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"activity\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"workspace\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}}"
                         ));

            var response = WorkerResource.Create("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FriendlyName", client: twilioRestClient);

            Assert.NotNull(response);
        }
Ejemplo n.º 17
0
        public void TestReadFullResponse()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();

            twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
            twilioRestClient.Request(Arg.Any <Request>())
            .Returns(new Response(
                         System.Net.HttpStatusCode.OK,
                         "{\"meta\": {\"first_page_url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers?PageSize=50&Page=0\",\"key\": \"workers\",\"next_page_url\": null,\"page\": 0,\"page_size\": 50,\"previous_page_url\": null,\"url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers?PageSize=50&Page=0\"},\"workers\": [{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"activity_name\": \"Offline\",\"activity_sid\": \"WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": \"{}\",\"available\": false,\"date_created\": \"2015-08-03T17:34:12Z\",\"date_status_changed\": \"2015-08-03T17:34:12Z\",\"date_updated\": \"2015-08-03T17:34:12Z\",\"friendly_name\": \"dc7d5461-3a05-11e5-a889-98e0d9a1eb73\",\"links\": {\"activity\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"workspace\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"sid\": \"WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"workspace_sid\": \"WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}]}"
                         ));

            var response = WorkerResource.Read("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient);

            Assert.NotNull(response);
        }
        public void TestReadEmptyResponse()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();

            twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
            twilioRestClient.Request(Arg.Any <Request>())
            .Returns(new Response(
                         System.Net.HttpStatusCode.OK,
                         "{\"meta\": {\"first_page_url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&TaskQueueSid=WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&FriendlyName=friendly_name&PageSize=50&Page=0\",\"key\": \"workers\",\"next_page_url\": null,\"page\": 0,\"page_size\": 50,\"previous_page_url\": null,\"url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers?Available=available&TargetWorkersExpression=target_workers_expression&TaskQueueName=task_queue_name&ActivityName=activity_name&ActivitySid=WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&TaskQueueSid=WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&FriendlyName=friendly_name&PageSize=50&Page=0\"},\"workers\": []}"
                         ));

            var response = WorkerResource.Read("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient);

            Assert.NotNull(response);
        }
Ejemplo n.º 19
0
        private static WorkerResource CreateWorker(string workerPoolId, int prefix)
        {
            var worker = new WorkerResource()
            {
                Name          = WorkerPrefix + Guid.NewGuid().ToString().Substring(0, 8) + "-" + prefix.ToString("000"),
                WorkerPoolIds = new ReferenceCollection(workerPoolId),
                Endpoint      = new ListeningTentacleEndpointResource()
                {
                    Uri        = "https://localhost:10940",                  // TODO: pass these as optional params?
                    Thumbprint = "62D0D4851EE3B94C5B4D221F5583577AB9DEC015", // TODO: pass these as optional params?
                },
            };

            return(worker);
        }
Ejemplo n.º 20
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken  = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var worker = WorkerResource.Create(
            friendlyName: "FriendlyName",
            pathWorkspaceSid: "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
            );

        Console.WriteLine(worker.Sid);
    }
        public IActionResult Agent_list()
        {
            TwilioClient.Init(_accountSid, _authToken);
            string expression = "worker.channel.voice.configured_capacity > 0";

            var agent_list = WorkerResource.Read(_workspaceSid, targetWorkersExpression: expression);


            foreach (var worker in agent_list)
            {
                Console.WriteLine("worker name: " + worker.FriendlyName);
            }
            ViewBag.voice_worker = agent_list;
            return(View());
        }
Ejemplo n.º 22
0
        public void TestReadEmptyResponse()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();

            twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
            twilioRestClient.Request(Arg.Any <Request>())
            .Returns(new Response(
                         System.Net.HttpStatusCode.OK,
                         "{\"meta\": {\"first_page_url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers?PageSize=50&Page=0\",\"key\": \"workers\",\"next_page_url\": null,\"page\": 0,\"page_size\": 50,\"previous_page_url\": null,\"url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers?PageSize=50&Page=0\"},\"workers\": []}"
                         ));

            var response = WorkerResource.Read("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient);

            Assert.NotNull(response);
        }
Ejemplo n.º 23
0
        public void TestReadFullResponse()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();

            twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
            twilioRestClient.Request(Arg.Any <Request>())
            .Returns(new Response(
                         System.Net.HttpStatusCode.OK,
                         "{\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"workers\"},\"workers\": [{\"sid\": \"WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"friendly_name\": \"testWorker\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"activity_sid\": \"WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"activity_name\": \"Offline\",\"workspace_sid\": \"WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": \"{}\",\"available\": false,\"date_created\": \"2017-05-30T23:05:29Z\",\"date_updated\": \"2017-05-30T23:05:29Z\",\"date_status_changed\": \"2017-05-30T23:05:29Z\",\"url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"channels\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels\",\"activity\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"workspace\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"statistics\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/Statistics\",\"real_time_statistics\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/RealTimeStatistics\",\"cumulative_statistics\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/CumulativeStatistics\",\"worker_statistics\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics\",\"worker_channels\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels\",\"reservations\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations\"}}]}"
                         ));

            var response = WorkerResource.Read("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient);

            Assert.NotNull(response);
        }
Ejemplo n.º 24
0
        public void TestDeleteResponse()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();

            twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
            twilioRestClient.Request(Arg.Any <Request>())
            .Returns(new Response(
                         System.Net.HttpStatusCode.NoContent,
                         "null"
                         ));

            var response = WorkerResource.Delete("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient);

            Assert.NotNull(response);
        }
Ejemplo n.º 25
0
        public void TestUpdateResponse()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();

            twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
            twilioRestClient.Request(Arg.Any <Request>())
            .Returns(new Response(
                         System.Net.HttpStatusCode.OK,
                         "{\"sid\": \"WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"friendly_name\": \"blah\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"activity_sid\": \"WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"activity_name\": \"Offline\",\"workspace_sid\": \"WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"attributes\": \"{}\",\"available\": false,\"date_created\": \"2017-05-30T23:32:22Z\",\"date_updated\": \"2017-05-31T00:05:57Z\",\"date_status_changed\": \"2017-05-30T23:32:22Z\",\"url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"channels\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels\",\"activity\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities/WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"workspace\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"statistics\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/Statistics\",\"real_time_statistics\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/RealTimeStatistics\",\"cumulative_statistics\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/CumulativeStatistics\",\"worker_statistics\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics\",\"worker_channels\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels\",\"reservations\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Reservations\"}}"
                         ));

            var response = WorkerResource.Update("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient);

            Assert.NotNull(response);
        }
Ejemplo n.º 26
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid   = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken    = "your_auth_token";
        const string workspaceSid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

        TwilioClient.Init(accountSid, authToken);

        var workers = WorkerResource.Read(workspaceSid);

        foreach (var worker in workers)
        {
            Console.WriteLine(worker.FriendlyName);
        }
    }
Ejemplo n.º 27
0
        public void CustomTest()
        {
            // Arrange
            WorkerResource resource1 = new WorkerResource()
            {
                Description         = "Магомед",
                WorkerQualification = Qualification.ThirdCategory
            };
            WorkerResource resource2;

            // Act
            resource2 = SaveTester <WorkerResource> .StartSaveTest(resource1);

            // Arranges
            Assert.AreEqual((resource1).Description, (resource2).Description);
            Assert.AreEqual((resource1).WorkerQualification, (resource2).WorkerQualification);
        }
Ejemplo n.º 28
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        // To set up environmental variables, see http://twil.io/secure
        const string accountSid   = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        const string authToken    = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");
        const string workspaceSid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

        TwilioClient.Init(accountSid, authToken);

        var workers = WorkerResource.Read(workspaceSid);

        foreach (var worker in workers)
        {
            Console.WriteLine(worker.FriendlyName);
        }
    }
Ejemplo n.º 29
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        // DANGER! This is insecure. See http://twil.io/secure
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken  = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var worker = WorkerResource.Update(
            activitySid: "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            pathWorkspaceSid: "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            pathSid: "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
            );

        Console.WriteLine(worker.ActivityName);
    }
Ejemplo n.º 30
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken  = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var workers = WorkerResource.Read(
            targetWorkersExpression: "type == 'leads'",
            pathWorkspaceSid: "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
            );

        foreach (var record in workers)
        {
            Console.WriteLine(record.Sid);
        }
    }