public StormglassParametersProvider(IResponseReader respReader, IWebServerHelper webHelper)
 {
     Weather         = new WeatherCharacterization();
     this.webHelper  = webHelper;
     this.respReader = respReader;
     paramsFiller    = new StormglassioParametersFiller();
 }
Exemplo n.º 2
0
 public StormglassioWeatherDisplayer(IWebServerHelper stormglassioHelper, IParametersFiller <StormglassDataHolder> stormglassioParamsFiller,
                                     IResponseReader respReader, ConsoleWriter writer)
 {
     ParamsFiller = stormglassioParamsFiller;
     Writer       = writer;
     WebHelper    = stormglassioHelper;
     RespReader   = respReader;
 }
 public WeatherDisplayer(IWebServerHelper tomorrowioHelper, IWebServerHelper stormglassioHelper)
 {
     StormglassioParamsFiller = new StormglassioParametersFiller();
     TomorrowioParamsFiller   = new TomorrowioParametersFiller();
     writer = new ConsoleWriter();
     this.tomorrowioWebHelper   = tomorrowioHelper;
     this.stormglassioWebHelper = stormglassioHelper;
 }
 public TomorrowioWeatherDisplayer(IWebServerHelper tomorrowioHelper, IParametersFiller <TomorrowDataHolder> tomorrowioParamsFiller,
                                   IResponseReader respReader, ConsoleWriter writer)
 {
     ParamsFiller = tomorrowioParamsFiller;
     Writer       = writer;
     WebHelper    = tomorrowioHelper;
     RespReader   = respReader;
 }
        public void FillRequestURL(IWebServerHelper webHelper)
        {
            Uri    initialURL    = new Uri("https://api.tomorrow.io/v4/timelines?");
            string fields        = "temperature,cloudCover,humidity,precipitationIntensity,windDirection,windSpeed";
            string apiKey        = "AVMNJMtSlSrsgXtt1gIB6x2MrgKqIqxO";
            string allParameters = String.Format("?location={0},{1}&fields={2}&timesteps=current&units=metric&apikey={3}",
                                                 latitude, longitude, fields, apiKey);
            Uri finalURL = new Uri(initialURL, allParameters);

            webHelper.RequestURL = finalURL;
        }
        public void FillRequestURL(IWebServerHelper webHelper)
        {
            var    timeStamp     = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds();
            string parameters    = "airTemperature,cloudCover,humidity,precipitation,windDirection,windSpeed";
            string source        = "noaa";
            Uri    initialURL    = new Uri("https://api.stormglass.io/v2/weather/point");
            string allParameters = String.Format("?lat={0}&lng={1}&params={2}&start={3}&end={4}&source={5}",
                                                 latitude, longitude, parameters, timeStamp, timeStamp, source);
            Uri finalURL = new Uri(initialURL, allParameters);

            webHelper.RequestURL = finalURL;
        }
 public bool FillParameters(IWebServerHelper webHelper, IResponseReader respReader)
 {
     stormglassRequestFiller.FillRequestURL(webHelper);
     if (webHelper.MakeRequest())
     {
         respReader.Response = webHelper.Response;
         string json = respReader.GetResponseInfo();
         StormGlassDataHolder stormglassDataHolder = JsonConvert.DeserializeObject <StormGlassDataHolder>(json);
         Parameters = stormglassMapper.GetParameters(stormglassDataHolder);
         return(true);
     }
     return(false);
 }
 public bool FillParameters(IWebServerHelper webHelper, IResponseReader respReader)
 {
     RequestURLFiller.FillRequestURL(webHelper);
     if (webHelper.MakeRequest())
     {
         respReader.Response = webHelper.Response;
         string json = respReader.GetResponseInfo();
         ExtractParameters(json);
         return(true);
     }
     Answer = webHelper.Answer;
     return(false);
 }
 public bool FillParameters(IWebServerHelper webHelper, IResponseReader respReader)
 {
     tomorrowRequestFiller.FillRequestURL(webHelper);
     if (webHelper.MakeRequest())
     {
         respReader.Response = webHelper.Response;
         string             json = respReader.GetResponseInfo();
         TomorrowDataHolder tomorrowDataHolder = JsonConvert.DeserializeObject <TomorrowDataHolder>(json);
         Parameters = tomorrowMapper.GetParameters(tomorrowDataHolder);
         return(true);
     }
     return(false);
 }