コード例 #1
0
 public void TestInitialize()
 {
     _pureCloud = new PureCloud
     {
         ClientId     = StaticConfig.ClientId,
         ClientSecret = StaticConfig.ClientSecret,
         Environment  = StaticConfig.Environment
     };
     _pureCloud.Login();
 }
コード例 #2
0
ファイル: WrapUpCodes.cs プロジェクト: alexismoussesian/pcsd
        public void TestInitialize()
        {
            _pureCloud = new PureCloud
            {
                ClientId     = StaticConfig.ClientId,
                ClientSecret = StaticConfig.ClientSecret,
                Environment  = StaticConfig.Environment
            };

            _pureCloud.Login();
            _pureCloud.GetUsers();
            _pureCloud.GetQueues();
            _pureCloud.GetLanguages();
        }
コード例 #3
0
ファイル: Login.cs プロジェクト: alexismoussesian/pcsd
        public void Should_Fail_When_No_ClientId_Were_Specified()
        {
            // Arrange

            // Act
            try
            {
                _pureCloud.Login();
            }
            catch (Exception ex)
            {
                // Assert
                Assert.AreEqual(typeof(ArgumentException), ex.GetType());
            }
        }
コード例 #4
0
ファイル: SqlPlugin.cs プロジェクト: alexismoussesian/pcsd
        public void TestInitialize()
        {
            _pureCloud = new PureCloud
            {
                ClientId     = StaticConfig.ClientId,
                ClientSecret = StaticConfig.ClientSecret,
                Environment  = StaticConfig.Environment
            };
            _pureCloud.Login();

            var args = new string[] { $"/clientid={StaticConfig.ClientId}",
                                      $"/clientsecret={StaticConfig.ClientSecret}",
                                      $"/environment={StaticConfig.Environment}",
                                      $"/target-sql={StaticConfig.Targetsql}" };

            _pureCloud.GetQueues();
            _pureCloud.GetUsers();
            _pureCloud.GetWrapUpCodes();

            _sql.Initialize(args);
            _sql.InitializeDictionaries(_pureCloud.ListOfQueues, _pureCloud.ListOfLanguages, _pureCloud.ListOfSkills, _pureCloud.ListOfUsers, _pureCloud.ListOfWrapUpCodes, _pureCloud.ListOfEdgeServers, _pureCloud.ListOfCampaigns, _pureCloud.ListOfContactLists, _pureCloud.ListOfPresences, _pureCloud.ListOfDivisions, _pureCloud.ListOfDataTables, _pureCloud.ListOfGroups, _pureCloud.ListOfRoles);
        }
コード例 #5
0
        public void TestInitialize()
        {
            _pluginsFolder = FileHelper.GetPluginsFolder();

            _args = new string[] { $"/clientid={StaticConfig.ClientId}",
                                   $"/clientsecret={StaticConfig.ClientSecret}",
                                   $"/environment={StaticConfig.Environment}",
                                   //"/stats=user",
                                   $"/target-sql={StaticConfig.Targetsql}",
                                   "/music" };

            // Load plugins
            _loadedPlugins = new PluginLoader().LoadPlugins(_pluginsFolder, _args, out _pluginsCmdArgsHelp);
            _pureCloud     = new PureCloud
            {
                ClientId     = StaticConfig.ClientId,
                ClientSecret = StaticConfig.ClientSecret,
                Environment  = StaticConfig.Environment
            };

            _pureCloud.Login();
        }
コード例 #6
0
ファイル: Main.cs プロジェクト: radtek/PureCloudExportTool
        private static readonly string[] DateTimeFormats = { "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss" }; // - formats from documentation: /startdate=2015-12-31 or /startdate="2015-12-31 14:00:00"

        public static void Begin(string[] args)
        {
            // initiate log
            BasicConfigurator.Configure();

            try
            {
                Log.Debug("Application is started");

                // Load plugins
                _loadedPlugins = new PluginLoader().LoadPlugins(PluginsFolder, args, out _pluginsCmdArgsHelp);

                // check parameters
                if (args.Length == 0 || args[0].Equals("/help"))
                {
                    ShowUsage();
                    ShowPressAnyKey();
                    return;
                }

                // Retrieve arguments from command line
                Log.Debug($"Number of command line parameters = {args.Length}");
                for (var i = 0; i < args.Length; i++)
                {
                    Log.Debug($"Arg[{i}] = [{args[i]}]");
                    var splittedArg = args[i].Replace("/", "").Split('=');
                    var key         = splittedArg[0];
                    var value       = "";
                    if (splittedArg.Length == 2)
                    {
                        value = splittedArg[1];
                    }
                    switch (key.ToLower())
                    {
                    case "clientid":
                        PureCloudObj.ClientId = value;
                        break;

                    case "clientsecret":
                        PureCloudObj.ClientSecret = value;
                        break;

                    case "environment":
                        PureCloudObj.Environment = value;
                        break;

                    case "stats":
                        _stats = value.ToLower().Split(',').ToList();
                        break;

                    case "startdate":
                        DateTime parsedValue;
                        if (DateTime.TryParseExact(value, DateTimeFormats, CultureInfo.CurrentCulture, DateTimeStyles.None, out parsedValue))
                        {
                            PureCloudObj.StartDate = parsedValue;
                            Log.Info($"Start date parameter: {PureCloudObj.StartDate?.ToString("o")}");
                        }
                        else
                        {
                            Log.Error($"Couldn't parse startdate. Delivered value:{value}, expected formats:{string.Join(", ", DateTimeFormats)}");
                        }
                        break;
                    }
                }

                // Set stats to default if it wasn't specified
                if (_stats.Count == 0)
                {
                    _stats = new List <string>()
                    {
                        "conversations",
                        "queues",
                        "users",
                        "userdetails"
                    };
                }

                // Login
                PureCloudObj.Login();

                // Load dictionaries & pull all analytics
                if (PureCloudObj.LoadAllDictionaries())
                {
                    Log.Info("All Dictionaries loaded.");
                    BeginProcess();
                }

                // And... we're done!
                PureCloudObj.Logout();
            }
            catch (ArgumentException ex)
            {
                Log.Fatal($"Application error {ex.Message}");
            }
            catch (NotImplementedException ex)
            {
                Log.Fatal($"Application error {ex.Message}");
            }
            catch (Exception ex)
            {
                Log.Fatal("Application error", ex);
                ShowUsage();
            }
            finally
            {
                if (_loadedPlugins != null)
                {
                    // Dispose all plugins

                    foreach (var loadedPlugin in _loadedPlugins)
                    {
                        loadedPlugin.Dispose();
                    }
                }
            }

            //AppTitle.StopProgress();
            //ShowPressAnyKey();
        }