mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 17:20:04 +00:00
Rename IEM warnings provider to IEM API provider
This commit is contained in:
parent
cf87cc9bf0
commit
f9e79b3e40
5 changed files with 25 additions and 25 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
#include <scwx/provider/iem_warnings_provider.hpp>
|
#include <scwx/provider/iem_api_provider.hpp>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
|
@ -7,12 +7,12 @@ namespace scwx
|
||||||
namespace provider
|
namespace provider
|
||||||
{
|
{
|
||||||
|
|
||||||
TEST(IemWarningsProviderTest, ListTextProducts)
|
TEST(IemApiProviderTest, ListTextProducts)
|
||||||
{
|
{
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
using sys_days = time_point<system_clock, days>;
|
using sys_days = time_point<system_clock, days>;
|
||||||
|
|
||||||
IemWarningsProvider provider {};
|
IemApiProvider provider {};
|
||||||
|
|
||||||
auto date = sys_days {2023y / March / 25d};
|
auto date = sys_days {2023y / March / 25d};
|
||||||
|
|
||||||
|
|
@ -30,14 +30,14 @@ TEST(IemWarningsProviderTest, ListTextProducts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(IemWarningsProviderTest, LoadTextProducts)
|
TEST(IemApiProviderTest, LoadTextProducts)
|
||||||
{
|
{
|
||||||
static const std::vector<std::string> productIds {
|
static const std::vector<std::string> productIds {
|
||||||
"202303250016-KMEG-WFUS54-TORMEG",
|
"202303250016-KMEG-WFUS54-TORMEG",
|
||||||
"202303252015-KFFC-WFUS52-TORFFC",
|
"202303252015-KFFC-WFUS52-TORFFC",
|
||||||
"202303311942-KLZK-WWUS54-SVSLZK"};
|
"202303311942-KLZK-WWUS54-SVSLZK"};
|
||||||
|
|
||||||
IemWarningsProvider provider {};
|
IemApiProvider provider {};
|
||||||
|
|
||||||
auto textProducts = provider.LoadTextProducts(productIds);
|
auto textProducts = provider.LoadTextProducts(productIds);
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ set(SRC_GR_TESTS source/scwx/gr/placefile.test.cpp)
|
||||||
set(SRC_NETWORK_TESTS source/scwx/network/dir_list.test.cpp)
|
set(SRC_NETWORK_TESTS source/scwx/network/dir_list.test.cpp)
|
||||||
set(SRC_PROVIDER_TESTS source/scwx/provider/aws_level2_data_provider.test.cpp
|
set(SRC_PROVIDER_TESTS source/scwx/provider/aws_level2_data_provider.test.cpp
|
||||||
source/scwx/provider/aws_level3_data_provider.test.cpp
|
source/scwx/provider/aws_level3_data_provider.test.cpp
|
||||||
source/scwx/provider/iem_warnings_provider.test.cpp
|
source/scwx/provider/iem_api_provider.test.cpp
|
||||||
source/scwx/provider/warnings_provider.test.cpp)
|
source/scwx/provider/warnings_provider.test.cpp)
|
||||||
set(SRC_QT_CONFIG_TESTS source/scwx/qt/config/county_database.test.cpp
|
set(SRC_QT_CONFIG_TESTS source/scwx/qt/config/county_database.test.cpp
|
||||||
source/scwx/qt/config/radar_site.test.cpp)
|
source/scwx/qt/config/radar_site.test.cpp)
|
||||||
|
|
|
||||||
|
|
@ -11,17 +11,17 @@ namespace scwx::provider
|
||||||
/**
|
/**
|
||||||
* @brief Warnings Provider
|
* @brief Warnings Provider
|
||||||
*/
|
*/
|
||||||
class IemWarningsProvider
|
class IemApiProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit IemWarningsProvider();
|
explicit IemApiProvider();
|
||||||
~IemWarningsProvider();
|
~IemApiProvider();
|
||||||
|
|
||||||
IemWarningsProvider(const IemWarningsProvider&) = delete;
|
IemApiProvider(const IemApiProvider&) = delete;
|
||||||
IemWarningsProvider& operator=(const IemWarningsProvider&) = delete;
|
IemApiProvider& operator=(const IemApiProvider&) = delete;
|
||||||
|
|
||||||
IemWarningsProvider(IemWarningsProvider&&) noexcept;
|
IemApiProvider(IemApiProvider&&) noexcept;
|
||||||
IemWarningsProvider& operator=(IemWarningsProvider&&) noexcept;
|
IemApiProvider& operator=(IemApiProvider&&) noexcept;
|
||||||
|
|
||||||
static std::vector<std::string>
|
static std::vector<std::string>
|
||||||
ListTextProducts(std::chrono::sys_time<std::chrono::days> date,
|
ListTextProducts(std::chrono::sys_time<std::chrono::days> date,
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include <scwx/provider/iem_warnings_provider.hpp>
|
#include <scwx/provider/iem_api_provider.hpp>
|
||||||
#include <scwx/network/cpr.hpp>
|
#include <scwx/network/cpr.hpp>
|
||||||
#include <scwx/types/iem_types.hpp>
|
#include <scwx/types/iem_types.hpp>
|
||||||
#include <scwx/util/json.hpp>
|
#include <scwx/util/json.hpp>
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
namespace scwx::provider
|
namespace scwx::provider
|
||||||
{
|
{
|
||||||
|
|
||||||
static const std::string logPrefix_ = "scwx::provider::iem_warnings_provider";
|
static const std::string logPrefix_ = "scwx::provider::iem_api_provider";
|
||||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||||
|
|
||||||
static const std::string kBaseUrl_ = "https://mesonet.agron.iastate.edu/api/1";
|
static const std::string kBaseUrl_ = "https://mesonet.agron.iastate.edu/api/1";
|
||||||
|
|
@ -18,7 +18,7 @@ static const std::string kBaseUrl_ = "https://mesonet.agron.iastate.edu/api/1";
|
||||||
static const std::string kListNwsTextProductsEndpoint_ = "/nws/afos/list.json";
|
static const std::string kListNwsTextProductsEndpoint_ = "/nws/afos/list.json";
|
||||||
static const std::string kNwsTextProductEndpoint_ = "/nwstext/";
|
static const std::string kNwsTextProductEndpoint_ = "/nwstext/";
|
||||||
|
|
||||||
class IemWarningsProvider::Impl
|
class IemApiProvider::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl() = default;
|
explicit Impl() = default;
|
||||||
|
|
@ -29,15 +29,15 @@ public:
|
||||||
Impl& operator=(const Impl&&) = delete;
|
Impl& operator=(const Impl&&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
IemWarningsProvider::IemWarningsProvider() : p(std::make_unique<Impl>()) {}
|
IemApiProvider::IemApiProvider() : p(std::make_unique<Impl>()) {}
|
||||||
IemWarningsProvider::~IemWarningsProvider() = default;
|
IemApiProvider::~IemApiProvider() = default;
|
||||||
|
|
||||||
IemWarningsProvider::IemWarningsProvider(IemWarningsProvider&&) noexcept =
|
IemApiProvider::IemApiProvider(IemApiProvider&&) noexcept =
|
||||||
default;
|
default;
|
||||||
IemWarningsProvider&
|
IemApiProvider&
|
||||||
IemWarningsProvider::operator=(IemWarningsProvider&&) noexcept = default;
|
IemApiProvider::operator=(IemApiProvider&&) noexcept = default;
|
||||||
|
|
||||||
std::vector<std::string> IemWarningsProvider::ListTextProducts(
|
std::vector<std::string> IemApiProvider::ListTextProducts(
|
||||||
std::chrono::sys_time<std::chrono::days> date,
|
std::chrono::sys_time<std::chrono::days> date,
|
||||||
std::optional<std::string_view> cccc,
|
std::optional<std::string_view> cccc,
|
||||||
std::optional<std::string_view> pil)
|
std::optional<std::string_view> pil)
|
||||||
|
|
@ -137,7 +137,7 @@ std::vector<std::string> IemWarningsProvider::ListTextProducts(
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::shared_ptr<awips::TextProductFile>>
|
std::vector<std::shared_ptr<awips::TextProductFile>>
|
||||||
IemWarningsProvider::LoadTextProducts(
|
IemApiProvider::LoadTextProducts(
|
||||||
const std::vector<std::string>& textProducts)
|
const std::vector<std::string>& textProducts)
|
||||||
{
|
{
|
||||||
auto parameters = cpr::Parameters {{"nolimit", "true"}};
|
auto parameters = cpr::Parameters {{"nolimit", "true"}};
|
||||||
|
|
@ -61,14 +61,14 @@ set(SRC_NETWORK source/scwx/network/cpr.cpp
|
||||||
set(HDR_PROVIDER include/scwx/provider/aws_level2_data_provider.hpp
|
set(HDR_PROVIDER include/scwx/provider/aws_level2_data_provider.hpp
|
||||||
include/scwx/provider/aws_level3_data_provider.hpp
|
include/scwx/provider/aws_level3_data_provider.hpp
|
||||||
include/scwx/provider/aws_nexrad_data_provider.hpp
|
include/scwx/provider/aws_nexrad_data_provider.hpp
|
||||||
include/scwx/provider/iem_warnings_provider.hpp
|
include/scwx/provider/iem_api_provider.hpp
|
||||||
include/scwx/provider/nexrad_data_provider.hpp
|
include/scwx/provider/nexrad_data_provider.hpp
|
||||||
include/scwx/provider/nexrad_data_provider_factory.hpp
|
include/scwx/provider/nexrad_data_provider_factory.hpp
|
||||||
include/scwx/provider/warnings_provider.hpp)
|
include/scwx/provider/warnings_provider.hpp)
|
||||||
set(SRC_PROVIDER source/scwx/provider/aws_level2_data_provider.cpp
|
set(SRC_PROVIDER source/scwx/provider/aws_level2_data_provider.cpp
|
||||||
source/scwx/provider/aws_level3_data_provider.cpp
|
source/scwx/provider/aws_level3_data_provider.cpp
|
||||||
source/scwx/provider/aws_nexrad_data_provider.cpp
|
source/scwx/provider/aws_nexrad_data_provider.cpp
|
||||||
source/scwx/provider/iem_warnings_provider.cpp
|
source/scwx/provider/iem_api_provider.cpp
|
||||||
source/scwx/provider/nexrad_data_provider.cpp
|
source/scwx/provider/nexrad_data_provider.cpp
|
||||||
source/scwx/provider/nexrad_data_provider_factory.cpp
|
source/scwx/provider/nexrad_data_provider_factory.cpp
|
||||||
source/scwx/provider/warnings_provider.cpp)
|
source/scwx/provider/warnings_provider.cpp)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue