diff options
author | tastytea | 2020-01-05 09:38:13 +0100 |
---|---|---|
committer | tastytea | 2020-01-05 09:38:13 +0100 |
commit | f8727070361958a73e1d30dd39be824a674483b3 (patch) | |
tree | e32d253a28e534b92ef6adb59c3baaf4d4a8dae4 | |
parent | edc2bba718391aaec685b991b70fd5e574bf4d03 (diff) | |
download | mastodonpp-f8727070361958a73e1d30dd39be824a674483b3.tar mastodonpp-f8727070361958a73e1d30dd39be824a674483b3.tar.gz mastodonpp-f8727070361958a73e1d30dd39be824a674483b3.zip |
Renamed “Request” to “Connection”.
It will be used not for only one request, but for all requests to an instance.
-rw-r--r-- | include/connection.hpp (renamed from include/request.hpp) | 16 | ||||
-rw-r--r-- | include/mastodonpp.hpp | 2 | ||||
-rw-r--r-- | src/connection.cpp (renamed from src/request.cpp) | 8 | ||||
-rw-r--r-- | tests/test_instanciation.cpp | 6 |
4 files changed, 16 insertions, 16 deletions
diff --git a/include/request.hpp b/include/connection.hpp index 36d4f41..1db8286 100644 --- a/include/request.hpp +++ b/include/connection.hpp @@ -14,8 +14,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef MASTODONPP_REQUEST_HPP -#define MASTODONPP_REQUEST_HPP +#ifndef MASTODONPP_CONNECTION_HPP +#define MASTODONPP_CONNECTION_HPP #include "api.hpp" #include "curl_wrapper.hpp" @@ -30,23 +30,23 @@ namespace mastodonpp using std::string; /*! - * @brief Used to make a request to the Mastodon %API. + * @brief Represents a connection to an instance. Used for requests. * * @since 0.1.0 * - * @headerfile request.hpp mastodonpp/request.hpp + * @headerfile connection.hpp mastodonpp/connection.hpp */ -class Request : public CURLWrapper +class Connection : public CURLWrapper { public: /*! - * @brief Construct a new Request object. + * @brief Construct a new Connection object. * * @param instance An Instance with the access data. * * @since 0.1.0 */ - explicit Request(Instance &instance); + explicit Connection(Instance &instance); /*! * @brief Make a HTTP GET call. @@ -75,4 +75,4 @@ private: } // namespace mastodonpp -#endif // MASTODONPP_REQUEST_HPP +#endif // MASTODONPP_CONNECTION_HPP diff --git a/include/mastodonpp.hpp b/include/mastodonpp.hpp index 8b7ed45..2c24c85 100644 --- a/include/mastodonpp.hpp +++ b/include/mastodonpp.hpp @@ -20,7 +20,7 @@ #include "api.hpp" #include "exceptions.hpp" #include "instance.hpp" -#include "request.hpp" +#include "connection.hpp" #include "return_types.hpp" /*! diff --git a/src/request.cpp b/src/connection.cpp index 1e91504..b7fe886 100644 --- a/src/request.cpp +++ b/src/connection.cpp @@ -14,23 +14,23 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "request.hpp" +#include "connection.hpp" namespace mastodonpp { -Request::Request(Instance &instance) +Connection::Connection(Instance &instance) : _instance{instance} {} -answer_type Request::get(API::endpoint_type endpoint) +answer_type Connection::get(API::endpoint_type endpoint) { answer_type answer; answer.body = API{endpoint}.to_string(); return answer; } -answer_type Request::get(string endpoint) +answer_type Connection::get(string endpoint) { answer_type answer; answer.body = make_request(http_method::GET, "https://ip.tastytea.de/"); diff --git a/tests/test_instanciation.cpp b/tests/test_instanciation.cpp index 3bd73ec..bde806a 100644 --- a/tests/test_instanciation.cpp +++ b/tests/test_instanciation.cpp @@ -15,7 +15,7 @@ */ #include "instance.hpp" -#include "request.hpp" +#include "connection.hpp" #include <catch.hpp> @@ -48,12 +48,12 @@ SCENARIO ("Instantiations.") } } - WHEN ("Request is instantiated.") + WHEN ("Connection is instantiated.") { try { Instance instance{"example.com", ""}; - Request request{instance}; + Connection connection{instance}; } catch (const std::exception &e) { |