Skip to content

Instantly share code, notes, and snippets.

@tshddx
Created October 30, 2012 22:40
Show Gist options
  • Save tshddx/3983574 to your computer and use it in GitHub Desktop.
Save tshddx/3983574 to your computer and use it in GitHub Desktop.
proposed json format
{
:stream => [
{
:user => external_hash, # perhaps some sort of partial or ad hoc hash
:type => "leaderboard|challenge",
# slightly counterintuitively, challenge will always be present
# even if type is leaderboard
:challenge => {
# status is from the perspective of current_user.
# "closed" will also cover the case of neither user having ever challenged the other
:status => "incoming|outgoing|closed",
# all other keys can be absent/nil/whatever
:losses => 3,
:wins => 3,
# these will get displayed in order.
# display scores should support HTML (for text color).
# should be empty array if there's no match history.
:match_history => [
{
:number => 2,
:self_display_score => "400 yards",
:other_display_score => "405 yards|waiting...|etc."
},
{
:number => 1,
:self_display_score => "330 yards",
:other_display_score => "388 yards"
},
],
},
:rank_text => "1|Win|Loss|etc.", # probably needs HTML support
:subtext => "Win 13%|400 yards|No score" # probably needs HTML support, and can be nil, which would cause the user display name to be centered vertically in the feedlette row
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment