lib/soundcloud/models/track.rb in soundcloud-ruby-api-wrapper-0.1.8 vs lib/soundcloud/models/track.rb in soundcloud-ruby-api-wrapper-0.1.9
- old
+ new
@@ -40,10 +40,12 @@
#
# http://wiki.github.com/soundcloud/api/documentation#track
#
# Examples:
#
+ # some_user = sc_client.User.find('some_user')
+ #
# # gets 50 (Soundcloud API limit) tracks from some_user
# some_user_tracks = some_user.tracks
#
# # gets the latest song from some_user_tracks
# first_song = some_user_tracks.first
@@ -56,32 +58,28 @@
# timestamp = "@#{comment.timestamp/1000}"
# end
# p "#{comment.user.username} #{timestamp}: #{comment.body}"
# end
#
+ # # downloads the original track file (track.downloadable must be true)
+ # # (the open call requires the 'open-uri' gem)
+ # downloaded_file = open first_song.download_url
#
+ #
# # gets 50 (Soundcloud API limit) tracks with a BPM <= 100
# slow_tracks = sc_client.Track.find(:all, :params => { "bpm[to]" => "100"} )
#
#
# # create a new Track on Soundcloud with some_sound_file.mp3 as asset data
# new_track = sc_client.Track.new
# new_track.title = 'New Track'
# new_track.sharing = 'private'
# new_track.asset_data = File.new('some_sound_file.wav')
# new_track.save
- #
- # # downloads the original soundfile.
- # #some_sound_file.wav and downloaded_file should be the same (the open call requires the 'open-uri' gem)
- # downloaded_file = open new_track.download_url
#
# # gives some_user permission to access the new_track
- # some_user = sc_client.User.find('some_user')
# new_track.permissions << some_user
# new_track.permissions.save
- #
- #
- #
#
class Track < Base
belongs_to :user
has_many :permissions, :comments