各種Exceptionの用意(#53)
Tweetオブジェクトを仮実装(#54) Tweetオブジェクトのパースに当たり、httpPostのステータスコードを取得(#54) 各種オブジェクトにパースするためにhttpPostに渡すコールバックの引数を変更
This commit is contained in:
@@ -10,7 +10,6 @@ Tweet Tweet::parse(const unsigned int _responseCode, const std::string& _json) {
|
||||
Tweet tweet;
|
||||
|
||||
if (_responseCode == 200) {
|
||||
Tweet tweet;
|
||||
tweet.id(j["id_str"]);
|
||||
} else {
|
||||
auto error = j["errors"][0]["code"];
|
||||
@@ -23,11 +22,11 @@ Tweet Tweet::parse(const unsigned int _responseCode, const std::string& _json) {
|
||||
return tweet;
|
||||
}
|
||||
|
||||
void Tweet::id(const std::string& _id) {
|
||||
void Tweet::id(const std::string _id) {
|
||||
id_ = _id;
|
||||
}
|
||||
|
||||
const std::string& Tweet::id() const {
|
||||
const std::string Tweet::id() const {
|
||||
return id_;
|
||||
}
|
||||
} // namespace CocoaTweet::API::Model
|
||||
|
||||
@@ -11,8 +11,8 @@ public:
|
||||
Tweet(const unsigned int _responseCode, const std::string& _json)
|
||||
: Tweet(Tweet::parse(_responseCode, _json)) {}
|
||||
static Tweet parse(const unsigned int _responseCode, const std::string& _json);
|
||||
void id(const std::string& _id);
|
||||
const std::string& id() const;
|
||||
void id(const std::string _id);
|
||||
const std::string id() const;
|
||||
|
||||
private:
|
||||
std::string id_;
|
||||
|
||||
Reference in New Issue
Block a user