Exemple #1
0
        public HikesModel()
        {
            string googleApiKey = Environment.GetEnvironmentVariable(EnvironmentVariables.GoogleApiKeyVarName) ?? throw new Exception("Api Key env-var not found.");

            SheetId = Environment.GetEnvironmentVariable(EnvironmentVariables.HikesGoogleSheetIdKeyVarName) ?? throw new Exception("Sheet Id env-var not found.");

            _liveDataSource = new WebRestService(new Uri($"{GoogleSheetsBaseUrl}{SheetId}/values/Sheet1!A1:Z500?key={googleApiKey}"));
        }
Exemple #2
0
        public IndexModel()
        {
            string googleApiKey = Environment.GetEnvironmentVariable(EnvironmentVariables.GoogleApiKeyVarName) ?? throw new Exception("Api Key env-var not found.");

            SheetId = Environment.GetEnvironmentVariable(EnvironmentVariables.GoogleSheetIdKeyVarName) ?? throw new Exception("Sheet Id env-var not found.");
            string backupUrl = Environment.GetEnvironmentVariable(EnvironmentVariables.DataBackupUrlVarName) ?? throw new Exception("Data Backup URL env-var not found.");

            _liveDataSource = new WebRestService(new Uri($"{GoogleSheetsBaseUrl}{SheetId}/values/Sheet1!A1:Z500?key={googleApiKey}"));

            var backupWebService = new WebRestService(new Uri(backupUrl));

            _backupService = new JsonBackupService(
                new TimeService(),
                backupWebService,
                7);
        }