Class: Soundcloud2::Comments

Inherits:
Client
  • Object
show all
Defined in:
lib/soundcloud2/comments.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Client

#groups, #playlists, #tracks, #users

Constructor Details

#initialize(*args) ⇒ Comments

Initialize on the Soundcloud::Client class



6
7
8
# File 'lib/soundcloud2/comments.rb', line 6

def initialize(*args)
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



15
16
17
18
19
# File 'lib/soundcloud2/comments.rb', line 15

def method_missing(sym, *args, &block)
   options 	= args.extract_options!.merge(:client_id => api_key)
    response 	= conn.get("/#{sym.to_s}/#{args[0]}.json") { |req| req.params = options }
    args.nil? ? response.body.send(sym) : response.body
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



3
4
5
# File 'lib/soundcloud2/comments.rb', line 3

def api_key
  @api_key
end

#connObject (readonly)

Returns the value of attribute conn.



3
4
5
# File 'lib/soundcloud2/comments.rb', line 3

def conn
  @conn
end

Instance Method Details

#comments(*args) ⇒ Object

GET /comments/id a group



11
12
13
# File 'lib/soundcloud2/comments.rb', line 11

def comments(*args)
  	super 
end