Ejemplo n.º 1
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log, ExecutionContext context)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            var config = new ConfigurationBuilder()
                         .SetBasePath(context.FunctionAppDirectory)
                         .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
                         .AddEnvironmentVariables()
                         .Build();

            log.LogInformation("load google api config");
            var googleConfig = new GoogleApiConfig();

            config.GetSection("GoogleApiConfig").Bind(googleConfig);
            googleConfig.private_key = googleConfig.private_key.Replace(@"\n", "\n");

            var mylogger = new ServiceLogger();

            using (var google = new ServiceGoogleSheet(googleConfig, mylogger))
            {
                var rss       = new ServiceRSS(google.GetRssFeedUrl());
                var sendgrid  = new ServiceSendGrid(google);
                var processor = new Processor(google, rss, sendgrid, mylogger);
                await processor.Run();
            }

            log.LogInformation(mylogger.Flush());

            return((ActionResult) new OkObjectResult(mylogger.Flush()));
        }
Ejemplo n.º 2
0
        public static GoogleApiConfig GetGoogleApplicationConfiguration(string outputPath)
        {
            var configuration = new GoogleApiConfig();

            var iConfig = GetIConfigurationRoot(outputPath);

            iConfig
            .GetSection("GoogleApiConfig")
            .Bind(configuration);

            return(configuration);
        }
Ejemplo n.º 3
0
 /*public interface ISortServiceFactory
  * {
  *  SmartSortService Get();
  * }*/
 public ScheduleInfoProvider(GoogleApiConfig config, SmartSortService smartSortService)
 {
     this.config           = config;
     this.smartSortService = smartSortService;
 }