30 lines
710 B
Ruby
30 lines
710 B
Ruby
object @jam_track
|
|
|
|
attributes :id, :name, :description, :recording_type, :original_artist, :songwriter, :publisher, :sales_region, :price, :version
|
|
|
|
node :genres do |item|
|
|
[item.genre.description] # XXX: need to return single genre; not array
|
|
end
|
|
|
|
node :added_cart do |item|
|
|
any_user.shopping_carts.where(cart_id: item.id).count != 0
|
|
end
|
|
|
|
node :purchased do |item|
|
|
!!item.right_for_user(current_user)
|
|
end
|
|
|
|
child(:jam_track_tracks => :tracks) {
|
|
attributes :id, :part, :instrument, :track_type
|
|
|
|
node do |track|
|
|
{
|
|
preview_mp3_url: track.preview_public_url('mp3'),
|
|
preview_ogg_url: track.preview_public_url('ogg')
|
|
}
|
|
end
|
|
}
|
|
|
|
child(:licensor => :licensor) {
|
|
attributes :id, :name
|
|
} |