Skip to content

Instantly share code, notes, and snippets.

@sorpaas
Last active August 29, 2015 14:03
Show Gist options
  • Save sorpaas/d458f44898e9fa669d54 to your computer and use it in GitHub Desktop.
Save sorpaas/d458f44898e9fa669d54 to your computer and use it in GitHub Desktop.
Shortcool Requirements
header 'Authorization: Token :token'
get '/login/weibo?access_token=:access_token' => status(200)
get '/channels' => [ { id: _, title: _, description: _, videos: [ { id: _, title: _, tag: _, image: _ } ] } ]
get '/channels/:id' => { id: _, title: _, description: _, videos: [ { id: _, title: _, tag: _, image: _ } ] }
get '/videos?sort_by=default&from=:from&to=:to' => [ { id: _, title: _, tag: _, image: _ } ]
get '/videos?sort_by=random&from=:from&to=:to[&random_id=:id]' => [ { id: _, title: _, tag: _, image: _ } ]
get '/videos/:id' => { id: _, title: _, description: _, like_count: _, channel: { id: _, title: _, description: _ }, author: { id: _, name: _, avatar: _ } }
get '/videos/:id/liked?from=:from&to=:to' => [ { id: _, name: _, avatar: _ } ]
post '/videos/:id/like' => status(200)
get '/user/:id' => { id: _, name: _, avatar: _, type: _ }
update '/user/me', { name: _, avatar: _ } => status(200)
delete '/user/me' => status(200)
get '/user/:id/liked?from=:from&to=:to' => [ { id: _, title: _, tag: _, image: _ } ]
get '/user/:id/published?from=:from&to=:to' => [ { id: _, title: _, tag: _, image: _ } ]
post '/search', { keyword: _ } => [ { id: _, title: _, tag: _, image: _ } ]
get '/hot_keywords' => { videos: [ { title: _, id: _ } ], channels: [ { title: _, id: _ } ], organizations: [ { title: _, id: _ } ] }
table User do
column :type
column :name
column :avatar
end
table UserLiked do
column :user_id
column :video_id
end
table Bookmark do
column :user_id
column :video_id
end
table Channel do
column :title
column :description
end
table Video do
column :title
column :tag
column :image
column :url
column :author_id
column :channel_id
end
class Person
can :register
can :login
#can :get_channel_list, question: "Not in requirements??"
can :get_channel_detail, with: [:description, :video_list], video_list_with: [:title, :image]
can :get_video_list, :array, sort_by: manual, with: [:title, :tag, :image]
can :get_video_detail, with: [:channel_name, :title, :author, :description, :likes]
can :get_video_liked_users, :array, with: [:name, :avatar]
can :get_user_detail, with: [:type], organization_with: [:name, :avatar, :description, :published_video_list], individual_with: [:name, :avatar, :liked_video_list], video_list_with: [:title, :tag, :image]
can :search, return_with: [:video_list], video_list_with: [:title, :tag, :image]
can :get_hot_search_video, with: [:name, :video_id]
can :get_hot_search_channel, with: [:name, :channel_id]
can :get_hot_search_organization, with: [:name, :organization_id]
can :random_play_next, given: :current_playing_or_nil, return_with: [:video_id]
end
class User < Person
can :bookmark
#can :mark, question: "What's 'mark'??"
#can :comment, question: "Where's the page and requirements??"
#can :share, comment: "Only on iPhone"
can :get_my_bookmarks, :array, with: [:title, :tag, :image]
end
#Question: How do user register?
#Question: How do user login?
#Question: Can user modify its own personal information?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment