コード例 #1
0
        public void RiteAidCreate()
        {
            var data = new RiteAidData()
            {
                BirthDate  = "01/01/2000",
                City       = "Downingtown",
                StateCode  = "PA",
                StateName  = "Pennsylvania",
                Zip        = "19335",
                Condition  = ConditionType.WeakendImmuneSystem,
                Occupation = OccupationType.NoneOfTheAbove
            };

            var cache     = new BrowserCache(1, data, Checker.Initializer, Checker.Resetter);
            var browser   = cache.Pop();
            var available = Checker.Check("19406", "11158", data, browser);
        }
コード例 #2
0
        private RiteAidWatcher(RiteAidConfig riteAidConfig)
        {
            Alerts = new List <Alert>();
            var configuration = provider.GetService <NotifierConfiguration>();

            Notifier     = new Notifier(configuration);
            Filter       = riteAidConfig.Filter;
            MaxMiles     = riteAidConfig.MaxMiles;
            BrowserCheck = riteAidConfig.BrowserCheck;
            riteAidData  = riteAidConfig.Data;
            DumpStateRules(riteAidData);
            if (BrowserCheck)
            {
                browserCache = new BrowserCache(MaxBrowsers, riteAidData, Checker.Initializer, Checker.Resetter);
                browserCache.Preload();
            }
        }
コード例 #3
0
        public void Test()
        {
            var data = new RiteAidData()
            {
                BirthDate  = "01/01/2000",
                City       = "Downingtown",
                StateName  = "Pennsylvania",
                Zip        = "19335",
                Condition  = ConditionType.WeakendImmuneSystem,
                Occupation = OccupationType.NoneOfTheAbove
            };

            var cache = new BrowserCache(5, data, Checker.Initializer, Checker.Resetter);

            var browser1 = cache.Pop();
            var browser2 = cache.Pop();

            cache.Push(browser1);

            browser1 = cache.Pop();
        }
コード例 #4
0
        private void DumpStateRules(RiteAidData data)
        {
            var jsonResponse = FetchRules().GetAwaiter().GetResult();
            var rules        = JsonConvert.DeserializeObject <RulesRoot>(jsonResponse);
            var found        = false;

            foreach (var conditions in rules.Conditions.Any)
            {
                if (conditions.All.Exists(c => c.Fact == "stateCode" && (string)c.Value == data.StateCode))
                {
                    found = true;
                    foreach (var condition in conditions.All)
                    {
                        Console.WriteLine($"{condition.Fact} {condition.Operator} {condition.Value}");
                    }
                }
            }

            if (!found)
            {
                Console.WriteLine($"No rules found for state {data.StateCode} - may not be able to find slots");
            }
        }