Class: Soundcloud::Models::Comment
- Defined in:
- lib/soundcloud/models/comment.rb
Overview
SC API Attributes (as of 26/05/09):
-
body
-
timestamp
-
id
-
track_id
-
user_id
-
uri
Custom Wrapper Attributes/Methods:
-
user
-
track
Look up the resource attributes and filtering usage here:
wiki.github.com/soundcloud/api/documentation#comment
Examples:
# add a comment to a track
some_track = sc_client.Track.find('some-track')
sc_client.Comment.create({:track => some_track, :body => 'Nice Track!'})
# optionally you can add a timestamp (in milliseconds)
sc_client.Comment.create({:track => some_track, :body => 'nice drums @ the 5th second!', :timestamp => 5000})
# display all comments of some track
some_track.comments.each do |comment|
p "#{comment.user.full_name} wrote: #{comment.body}"
end
Instance Method Summary collapse
-
#initialize(options) ⇒ Comment
constructor
A new instance of Comment.
Methods inherited from Base
can_be_a_single_changeable, has_many_single_changeable, #send_files
Constructor Details
#initialize(options) ⇒ Comment
Returns a new instance of Comment.
40 41 42 43 44 45 46 |
# File 'lib/soundcloud/models/comment.rb', line 40 def initialize() if not [:track].nil? [:track_id] = [:track].id .delete(:track) end super() end |