summaryrefslogtreecommitdiff
path: root/battleNetApi
diff options
context:
space:
mode:
Diffstat (limited to 'battleNetApi')
-rw-r--r--battleNetApi/include/token.hpp4
-rw-r--r--battleNetApi/src/token.cpp8
2 files changed, 6 insertions, 6 deletions
diff --git a/battleNetApi/include/token.hpp b/battleNetApi/include/token.hpp
index 1941ce5..7107eb0 100644
--- a/battleNetApi/include/token.hpp
+++ b/battleNetApi/include/token.hpp
@@ -5,7 +5,7 @@ class Token {
public:
Token(const std::string &iTokenFilePath);
std::string text() const;
- const bool hasTokenExpired() const;
+ const bool hasExpired() const;
void updateToken();
private:
@@ -21,7 +21,7 @@ class Token {
* or if there is no token at all.
*/
std::string generateToken();
- void writeNewTokenToLocalFile(const std::pair<std::string, std::uint64_t> &iToken) const;
+ void writeTokenToLocalFile(const std::pair<std::string, std::uint64_t> &iToken) const;
std::string getTokenFromLocalFile() const;
std::pair<std::string, std::uint64_t> getTokenWithApi() const;
std::chrono::seconds getCurrentTime() const;
diff --git a/battleNetApi/src/token.cpp b/battleNetApi/src/token.cpp
index e32a946..21717cb 100644
--- a/battleNetApi/src/token.cpp
+++ b/battleNetApi/src/token.cpp
@@ -14,7 +14,7 @@ Token::Token(const std::string &iTokenFilePath) : mFilePath{iTokenFilePath}, mTo
std::string Token::text() const { return mToken; }
-const bool Token::hasTokenExpired() const {
+const bool Token::hasExpired() const {
std::ifstream aTokenFile{mFilePath};
json aCredentialsFile = json::parse(aTokenFile);
if (not aCredentialsFile.contains("Token") or not aCredentialsFile["Token"].contains("ExpirationTime") or
@@ -42,14 +42,14 @@ std::string Token::getTokenFromLocalFile() const {
}
std::string Token::generateToken() {
- if (hasTokenExpired()) {
+ if (hasExpired()) {
const std::pair<std::string, std::uint64_t> kTokenContent{getTokenWithApi()};
- writeNewTokenToLocalFile(kTokenContent);
+ writeTokenToLocalFile(kTokenContent);
}
return getTokenFromLocalFile();
}
-void Token::writeNewTokenToLocalFile(const std::pair<std::string, std::uint64_t> &iToken) const {
+void Token::writeTokenToLocalFile(const std::pair<std::string, std::uint64_t> &iToken) const {
std::ifstream aTokenFileInput{mFilePath};
json aCredentialsFile = json::parse(aTokenFileInput);
aCredentialsFile["Token"]["Content"] = iToken.first;