Skip to content

Instantly share code, notes, and snippets.

@kb10uy
Created April 22, 2014 11:49
Show Gist options
  • Save kb10uy/11175698 to your computer and use it in GitHub Desktop.
Save kb10uy/11175698 to your computer and use it in GitHub Desktop.
//改良前のコード抜粋
if (artifact["target_object"] != null)
{
return DeserializeUserStreamEvent(content);
}
/*
・問題点
1.イベントの条件が「target_objectがあるかどうか」
2.そのせいでtarget_objectがないfollowとかuser_updateは
切り捨てられる
*/
//改良後
//条件をeventがあるかどうかにして
//更にtarget_objectがあるかどうかで分岐
if (artifact["event"] != null)
{
if (artifact["target_object"] != null)
{
return DeserializeUserStreamEvent(content);
}
else
{
//自作メソッド
//target_objectを変換しない以外は上に同じ
return DeserializeUserStreamUserEvent(content);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment