整形も兼ねてテストcommit

This commit is contained in:
keita
2021-02-25 17:14:33 +09:00
parent 24c067742b
commit 0beb522359
7 changed files with 24 additions and 17 deletions
+3 -1
View File
@@ -11,6 +11,8 @@ void Create::id(const std::string& _id) {
} }
void Create::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) { void Create::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
HttpPost::process(_oauth, [](const unsigned int _, const std::string& _srv) { std::cout << _srv << std::endl; }); HttpPost::process(_oauth, [](const unsigned int _, const std::string& _srv) {
std::cout << _srv << std::endl;
});
} }
} // namespace CocoaTweet::API::Favorites } // namespace CocoaTweet::API::Favorites
+3 -1
View File
@@ -11,6 +11,8 @@ void Destroy::id(const std::string& _id) {
} }
void Destroy::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) { void Destroy::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
HttpPost::process(_oauth, [](const unsigned int _,const std::string& _srv) { std::cout << _srv << std::endl; }); HttpPost::process(_oauth, [](const unsigned int _, const std::string& _srv) {
std::cout << _srv << std::endl;
});
} }
} // namespace CocoaTweet::API::Favorites } // namespace CocoaTweet::API::Favorites
+2 -2
View File
@@ -60,7 +60,7 @@ void HttpPost::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
CURL* curl; CURL* curl;
CURLcode res; CURLcode res;
std::string rcv; std::string rcv;
long responseCode; long responseCode;
curl = curl_easy_init(); curl = curl_easy_init();
url_ = url_; url_ = url_;
std::cout << "URL : " << url_ << std::endl; std::cout << "URL : " << url_ << std::endl;
@@ -78,7 +78,7 @@ void HttpPost::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
headers = curl_slist_append(headers, oauthHeader.c_str()); headers = curl_slist_append(headers, oauthHeader.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl); res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &responseCode); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &responseCode);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
} }
+7 -5
View File
@@ -8,12 +8,14 @@ void Destroy::id(const std::string _id) {
url_ = "https://api.twitter.com/1.1/statuses/destroy/" + _id + ".json"; url_ = "https://api.twitter.com/1.1/statuses/destroy/" + _id + ".json";
} }
CocoaTweet::API::Model::Tweet Destroy::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) { CocoaTweet::API::Model::Tweet Destroy::process(
std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
CocoaTweet::API::Model::Tweet tweet; CocoaTweet::API::Model::Tweet tweet;
HttpPost::process(_oauth, [&tweet](const unsigned int _responseCode, const std::string& _rsv) { HttpPost::process(_oauth,
tweet = CocoaTweet::API::Model::Tweet::parse(_responseCode, _rsv); [&tweet](const unsigned int _responseCode, const std::string& _rsv) {
}); tweet = CocoaTweet::API::Model::Tweet::parse(_responseCode, _rsv);
return tweet; });
return tweet;
} }
} // namespace CocoaTweet::API::Statuses } // namespace CocoaTweet::API::Statuses
+2 -2
View File
@@ -10,8 +10,8 @@ class Status : public groupInterface {
public: public:
Status() = default; Status() = default;
Status(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth); Status(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth);
CocoaTweet::API::Model::Tweet Update(const std::string& _status) const; CocoaTweet::API::Model::Tweet Update(const std::string& _status) const;
CocoaTweet::API::Model::Tweet Destroy(const std::string& _id) const; CocoaTweet::API::Model::Tweet Destroy(const std::string& _id) const;
private: private:
}; };
+6 -5
View File
@@ -13,11 +13,12 @@ void Update::status(const std::string _status) {
} }
CocoaTweet::API::Model::Tweet Update::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) { CocoaTweet::API::Model::Tweet Update::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
CocoaTweet::API::Model::Tweet tweet; CocoaTweet::API::Model::Tweet tweet;
HttpPost::process(_oauth, [&tweet](const unsigned int _responseCode, const std::string& _rsv) { HttpPost::process(_oauth,
tweet = CocoaTweet::API::Model::Tweet::parse(_responseCode, _rsv); [&tweet](const unsigned int _responseCode, const std::string& _rsv) {
}); tweet = CocoaTweet::API::Model::Tweet::parse(_responseCode, _rsv);
return tweet; });
return tweet;
} }
} // namespace CocoaTweet::API::Statuses } // namespace CocoaTweet::API::Statuses
+1 -1
View File
@@ -10,7 +10,7 @@ class Update : public CocoaTweet::API::Interface::HttpPost {
public: public:
Update(); Update();
void status(const std::string _status); void status(const std::string _status);
CocoaTweet::API::Model::Tweet process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth); CocoaTweet::API::Model::Tweet process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth);
private: private:
std::string status_; std::string status_;