jam-cloud/web/app/views/api_feeds/show.rabl

81 lines
2.1 KiB
Ruby

object @feed
glue :music_session_history do
node :type do |i|
'music_session_history'
end
attributes :id, :description, :genres, :created_at, :session_removed_at
child(:music_session => :music_session) do
# only show mount info if fan_access is public. Eventually we'll also need to show this in other scenarios, like if invited
child({:mount => :mount}, :if => lambda { |music_session| music_session.fan_access}) {
attributes :id, :name, :sourced, :listeners, :bitrate, :subtype, :url
node(:mime_type) { |mount| mount.resolve_string(:mime_type) }
node(:bitrate) { |mount| mount.resolve_string(:bitrate) }
node(:subtype) { |mount| mount.resolve_string(:subtype) }
}
end
end
glue :claimed_recording do
node :type do |i|
'claimed_recording'
end
attributes :id, :name, :description, :is_public, :is_downloadable, :genre_id
node :share_url do |claimed_recording|
unless claimed_recording.share_token.nil?
share_token_url(claimed_recording.share_token.token)
end
end
child(:recording => :recording) {
attributes :id, :created_at, :duration, :comment_count, :like_count, :play_count
child(:band => :band) {
attributes :id, :name, :location, :photo_url
}
child(:owner => :owner) {
attributes :id, :name, :location, :photo_url
}
child(:mixes => :mixes) {
attributes :id, :is_completed
node :mp3_url do |mix|
mix[:url]
end
node :ogg_url do |mix|
mix[:url]
end
}
child(:recorded_tracks => :recorded_tracks) {
attributes :id, :fully_uploaded, :client_track_id, :client_id, :instrument_id
node :url do |recorded_track|
recorded_track[:url]
end
child(:user => :user) {
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :photo_url
}
}
child(:comments => :comments) {
attributes :comment, :created_at
child(:user => :creator) {
attributes :id, :first_name, :last_name, :photo_url
}
}
}
end