Class: Soundcloud2::Groups

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Client

#method_missing, #playlists, #tracks, #users

Constructor Details

#initialize(*args) ⇒ Groups

Initialize on the Soundcloud::Client class



6
7
8
# File 'lib/soundcloud2/groups.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_keyObject (readonly)

Returns the value of attribute api_key.



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

def api_key
  @api_key
end

#connObject (readonly)

Returns the value of attribute conn.



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

def conn
  @conn
end

Instance Method Details

#groups(*args) ⇒ Object

GET /groups/id a group



11
12
13
14
15
# File 'lib/soundcloud2/groups.rb', line 11

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

#groups_contributors(*args) ⇒ Object

GET /groups/id/contributors list of users who contributed a track to the group



32
33
34
35
36
# File 'lib/soundcloud2/groups.rb', line 32

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

#groups_members(*args) ⇒ Object

GET /groups/id/members list of users who joined the group



25
26
27
28
29
# File 'lib/soundcloud2/groups.rb', line 25

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

#groups_moderators(*args) ⇒ Object

GET /groups/id/moderators list of users who moderate the group



18
19
20
21
22
# File 'lib/soundcloud2/groups.rb', line 18

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

#groups_tracks(*args) ⇒ Object

GET /groups/id/tracks list of contributed and approved tracks



46
47
48
49
50
# File 'lib/soundcloud2/groups.rb', line 46

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

#groups_users(*args) ⇒ Object

GET /groups/id/users list of users who contributed to, joined or moderate the group



39
40
41
42
43
# File 'lib/soundcloud2/groups.rb', line 39

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