Class: Soundcloud2::Tracks
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Tracks
constructor
Initialize on the Soundcloud::Client class.
-
#tracks(*args) ⇒ Object
GET /tracks/id a user.
-
#tracks_comments(*args) ⇒ Object
GET /tracks/id/comments comments for the track GET /tracks/id/comments/comment-id a comment for the track.
-
#tracks_favoriters(*args) ⇒ Object
GET /tracks/id/favoriters users who favorited the track GET /tracks/id/favoriters/user-id a user who has favorited to the track.
-
#tracks_secret_token(*args) ⇒ Object
GET /tracks/id/secret-token secret token of the track.
Methods inherited from Client
#groups, #method_missing, #playlists, #users
Constructor Details
#initialize(*args) ⇒ Tracks
Initialize on the Soundcloud::Client class
6 7 8 |
# File 'lib/soundcloud2/tracks.rb', line 6 def initialize(*args) super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Soundcloud2::Client
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/soundcloud2/tracks.rb', line 3 def api_key @api_key end |
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
3 4 5 |
# File 'lib/soundcloud2/tracks.rb', line 3 def conn @conn end |
Instance Method Details
#tracks(*args) ⇒ Object
GET /tracks/id a user
11 12 13 14 15 |
# File 'lib/soundcloud2/tracks.rb', line 11 def tracks(*args) = args..merge(:client_id => api_key) response = conn.get("/tracks/#{args[0]}.json") { |req| req.params = } args.nil? ? response.body.send(sym) : response.body end |
#tracks_comments(*args) ⇒ Object
GET /tracks/id/comments comments for the track GET /tracks/id/comments/comment-id a comment for the track
19 20 21 22 23 24 |
# File 'lib/soundcloud2/tracks.rb', line 19 def tracks_comments(*args) = args..merge(:client_id => api_key) response = conn.get("/tracks/#{args[0]}/comments.json") { |req| req.params = } args[1].nil? ? (response = conn.get("/tracks/#{args[0]}/comments.json") { |req| req.params = }) : (response = conn.get("/tracks/#{args[0]}/comments/#{args[1]}.json") { |req| req.params = }) args.nil? ? response.body.send(sym) : response.body end |
#tracks_favoriters(*args) ⇒ Object
GET /tracks/id/favoriters users who favorited the track GET /tracks/id/favoriters/user-id a user who has favorited to the track
28 29 30 31 32 |
# File 'lib/soundcloud2/tracks.rb', line 28 def tracks_favoriters(*args) = args..merge(:client_id => api_key) args[1].nil? ? (response = conn.get("/tracks/#{args[0]}/favoriters.json") { |req| req.params = }) : (response = conn.get("/tracks/#{args[0]}/favoriters/#{args[1]}.json") { |req| req.params = }) args.nil? ? response.body.send(sym) : response.body end |
#tracks_secret_token(*args) ⇒ Object
GET /tracks/id/secret-token secret token of the track
35 36 37 38 39 |
# File 'lib/soundcloud2/tracks.rb', line 35 def tracks_secret_token(*args) = args..merge(:client_id => api_key) response = conn.get("/tracks/#{args[0]}/secret-token.json") { |req| req.params = } args.nil? ? response.body.send(sym) : response.body end |