soundcloud2 0.3.3 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/.rvmrc +1 -2
- data/.travis.yml +5 -0
- data/Gemfile +1 -0
- data/README.md +7 -1
- data/lib/soundcloud2.rb +193 -121
- data/lib/soundcloud2/comments.rb +8 -5
- data/lib/soundcloud2/groups.rb +5 -1
- data/lib/soundcloud2/playlists.rb +1 -1
- data/lib/soundcloud2/tracks.rb +1 -1
- data/lib/soundcloud2/users.rb +24 -14
- data/lib/soundcloud2/version.rb +1 -1
- data/soundcloud2.gemspec +22 -24
- data/spec/client_spec.rb +55 -0
- data/spec/soundcloud2/comments_spec.rb +23 -0
- data/spec/soundcloud2/groups_spec.rb +63 -0
- data/spec/soundcloud2/playlists_spec.rb +39 -0
- data/spec/soundcloud2/search_tracks.rb +15 -0
- data/spec/soundcloud2/tracks_spec.rb +55 -0
- data/spec/soundcloud2/users_spec.rb +98 -0
- data/spec/spec_helper.rb +12 -4
- metadata +79 -70
- data/spec/client/client_spec.rb +0 -41
- data/spec/client/comments_spec.rb +0 -21
- data/spec/client/groups_spec.rb +0 -46
- data/spec/client/playlists_spec.rb +0 -31
- data/spec/client/search_tracks.rb +0 -35
- data/spec/client/tracks_spec.rb +0 -40
- data/spec/client/users_spec.rb +0 -71
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/.rvmrc
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
rvm 1.9.2
|
2
|
-
rvm gemset use soundcloud
|
1
|
+
rvm 1.9.2@soundcloud2 --create
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# Soundcloud2 API Client
|
2
|
+
[![Build Status](https://secure.travis-ci.org/amanelis/soundcloud2.png)](http://travis-ci.org/amanelis/soundcloud2)
|
3
|
+
|
4
|
+
[![Dependency Status](https://gemnasium.com/amanelis/soundcloud2.png)](https://gemnasium.com/amanelis/soundcloud2)
|
2
5
|
|
3
6
|
Simple Ruby wrapper for the Soundcloud API.
|
4
7
|
|
@@ -90,7 +93,7 @@ be found in the other subclassed modules.
|
|
90
93
|
$ bundle
|
91
94
|
|
92
95
|
#### Run rSpec
|
93
|
-
$ rspec
|
96
|
+
$ rspec spec
|
94
97
|
|
95
98
|
## Issues
|
96
99
|
None.
|
@@ -101,6 +104,9 @@ be found in the other subclassed modules.
|
|
101
104
|
|
102
105
|
* Initial version
|
103
106
|
|
107
|
+
### 0.3.3 - April 4th, 2012
|
108
|
+
|
109
|
+
* Rebuilt the specs to test for nil objects
|
104
110
|
|
105
111
|
## Under the hood
|
106
112
|
* [`Faraday`](https://github.com/technoweenie/faraday) REST client
|
data/lib/soundcloud2.rb
CHANGED
@@ -4,143 +4,215 @@ require 'core_ext/array'
|
|
4
4
|
require 'yajl'
|
5
5
|
|
6
6
|
module Soundcloud2
|
7
|
+
### Client
|
8
|
+
#
|
9
|
+
# Brings together a default class we use to setup our connection
|
10
|
+
# to the Soundcloud API. Here is where we will configure any HTTP
|
11
|
+
# options using Faraday as our middle ware to communicate to the API
|
12
|
+
#
|
13
|
+
#
|
14
|
+
# @attr: @api_key - allows use to access the API_KEY globally
|
15
|
+
# @attr: @conn - here is the main method we use to call http methods from
|
7
16
|
class Client
|
8
17
|
attr_reader :api_key, :conn
|
18
|
+
|
19
|
+
# Define a few helper methods that are not too important
|
20
|
+
#
|
9
21
|
|
10
|
-
|
11
|
-
|
12
|
-
|
22
|
+
## initialize
|
23
|
+
#
|
24
|
+
# @param: String[api_key] - required
|
25
|
+
# @return:
|
26
|
+
#
|
27
|
+
# Setups up our attr readers and most importantly the Faraday connection
|
28
|
+
# to the API.
|
29
|
+
#
|
30
|
+
# OPTIMIZE: eventually take out Faraday and move to NetHTTP for a lower level of control
|
31
|
+
def initialize(api_key)
|
32
|
+
@api_key = api_key
|
13
33
|
@conn = Faraday.new(:url => "https://api.soundcloud.com/") do |builder|
|
14
34
|
builder.use Faraday::Response::Mashify
|
15
35
|
builder.use Faraday::Response::ParseJson
|
16
36
|
builder.adapter Faraday.default_adapter
|
17
37
|
end
|
18
38
|
end
|
19
|
-
|
20
|
-
# PROPERTIES OF GROUPS API
|
21
|
-
# id integer ID 123
|
22
|
-
# uri API resource URL http://api.soundcloud.com/comments/32562
|
23
|
-
# created_at timestamp of creation "2009/08/13 18:30:10 +0000"
|
24
|
-
# permalink permalink of the resource "summer-of-69"
|
25
|
-
# permalink_url URL to the SoundCloud.com page "http://soundcloud.com/bryan/summer-of-69"
|
26
|
-
# artwork_url URL to a JPEG image "http://i1.sndcdn.com/a....-large.jpg?142a848"
|
27
|
-
# name name of the group "Field Recordings"
|
28
|
-
# description description of the group "field recordings from across the world"
|
29
|
-
# short_description short description of the group "field recordings!"
|
30
|
-
# creator mini user representation of the owner {id: 343, username: "Doctor Wilson"...}
|
31
|
-
def groups(*args); super; end
|
32
|
-
|
33
|
-
# PROPERTIES OF PLAYLISTS API
|
34
|
-
# id integer ID 123
|
35
|
-
# created_at timestamp of creation "2009/08/13 18:30:10 +0000"
|
36
|
-
# user-id user-id of the owner 343
|
37
|
-
# user mini user representation of the owner {id: 343, username: "Doctor Wilson"...}
|
38
|
-
# title track title "Summer of 69"
|
39
|
-
# permalink permalink of the resource "summer-of-69"
|
40
|
-
# permalink_url URL to the SoundCloud.com page "http://soundcloud.com/bryan/summer-of-69"
|
41
|
-
# uri API resource URL "http://api.soundcloud.com/tracks/123"
|
42
|
-
# sharing public/private sharing "public"
|
43
|
-
# purchase_url external purchase link "http://amazon.com/buy/a43aj0b03"
|
44
|
-
# artwork_url URL to a JPEG image "http://i1.sndcdn.com/a....-large.jpg?142a848"
|
45
|
-
# description HTML description "my first track"
|
46
|
-
# downloadable downloadable (boolean) false
|
47
|
-
# streamable streamable via API (boolean) true
|
48
|
-
# label label mini user object {id:123, username: "BeatLabel"...}
|
49
|
-
# duration duration in milliseconds 1203400
|
50
|
-
# genre genre "HipHop"
|
51
|
-
# shared_to_count number of sharings (if private) 45
|
52
|
-
# tag_list list of tags "tag1 \"hip hop\" geo:lat=32.444 geo:lon=55.33"
|
53
|
-
# label_id id of the label user 54677
|
54
|
-
# label_name label name "BeatLabel"
|
55
|
-
# license creative common license "no-rights-reserved"
|
56
|
-
# release release number 3234
|
57
|
-
# release_day day of the release 21
|
58
|
-
# release_month month of the release 5
|
59
|
-
# release_year year of the release 2001
|
60
|
-
# ean EAN identifier for the playlist "123-4354345-43"
|
61
|
-
# playlist_type playlist type "recording"
|
62
|
-
def playlists(*args); super; end
|
63
|
-
|
64
|
-
# PROPERTIES OF TRACKS API
|
65
|
-
# id integer ID 123
|
66
|
-
# created_at timestamp of creation "2009/08/13 18:30:10 +0000"
|
67
|
-
# user-id user-id of the owner 343
|
68
|
-
# user mini user representation of the owner {id: 343, username: "Doctor Wilson"...}
|
69
|
-
# title track title "Summer of 69"
|
70
|
-
# permalink permalink of the resource "summer-of-69"
|
71
|
-
# permalink_url URL to the SoundCloud.com page "http://soundcloud.com/bryan/summer-of-69"
|
72
|
-
# uri API resource URL "http://api.soundcloud.com/tracks/123"
|
73
|
-
# sharing public/private sharing "public"
|
74
|
-
# purchase_url external purchase link "http://amazon.com/buy/a43aj0b03"
|
75
|
-
# artwork_url URL to a JPEG image "http://i1.sndcdn.com/a....-large.jpg?142a848"
|
76
|
-
# description HTML description "my first track"
|
77
|
-
# downloadable downloadable (boolean) false
|
78
|
-
# streamable streamable via API (boolean) true
|
79
|
-
# label label mini user object {id:123, username: "BeatLabel"...}
|
80
|
-
# duration duration in milliseconds 1203400
|
81
|
-
# genre genre "HipHop"
|
82
|
-
# shared_to_count number of sharings (if private) 45
|
83
|
-
# tag_list list of tags "tag1 \"hip hop\" geo:lat=32.444 geo:lon=55.33"
|
84
|
-
# label_id id of the label user 54677
|
85
|
-
# label_name label name "BeatLabel"
|
86
|
-
# license creative common license "no-rights-reserved"
|
87
|
-
# release release number 3234
|
88
|
-
# release_day day of the release 21
|
89
|
-
# release_month month of the release 5
|
90
|
-
# release_year year of the release 2001
|
91
|
-
# state encoding state "finished"
|
92
|
-
# track_type track type "recording"
|
93
|
-
# waveform_url URL to PNG waveform image "http://w1.sndcdn.com/fxguEjG4ax6B_m.png"
|
94
|
-
# download_url URL to original file "http://api.soundcloud.com/tracks/3/download"
|
95
|
-
# stream_url link to 128kbs mp3 stream "http://api.soundcloud.com/tracks/3/stream"
|
96
|
-
# bpm beats per minute 120
|
97
|
-
# commentable track commentable (boolean) true
|
98
|
-
# isrc track ISRC "I123-545454"
|
99
|
-
# key_signature track key "Cmaj"
|
100
|
-
# comment_count track comment count 12
|
101
|
-
# download_count track download count 45
|
102
|
-
# playback_count track play count 435
|
103
|
-
# favoritings_count track favoriting count 6
|
104
|
-
# original_format file format of the original file "aiff"
|
105
|
-
# created_with the app that the track created {"id"=>3434, "..."=>nil}
|
106
|
-
# asset_data binary data of the audio file (only for uploading)
|
107
|
-
# artwork_data binary data of the artwork image (only for uploading)
|
108
|
-
# user_favorite track favorite of current user (boolean, authenticated requests only) 1
|
109
|
-
def tracks(*args); super; end
|
110
|
-
|
111
|
-
# PROPERTIES OF USERS API
|
112
|
-
# id integer ID 123
|
113
|
-
# permalink permalink of the resource "summer-of-69"
|
114
|
-
# username username "Doctor Wilson"
|
115
|
-
# uri API resource URL http://api.soundcloud.com/comments/32562
|
116
|
-
# permalink_url URL to the SoundCloud.com page "http://soundcloud.com/bryan/summer-of-69"
|
117
|
-
# avatar_url URL to a JPEG image "http://i1.sndcdn.com/a....-large.jpg?142a848"
|
118
|
-
# country country "Germany"
|
119
|
-
# full_name first and last name "Tom Wilson"
|
120
|
-
# city city "Berlin"
|
121
|
-
# description description "Another brick in the wall"
|
122
|
-
# discogs-name Discogs name "myrandomband"
|
123
|
-
# myspace-name MySpace name "myrandomband"
|
124
|
-
# website a URL to the website "http://facebook.com/myrandomband"
|
125
|
-
# website-title a custom title for the website "myrandomband on Facebook"
|
126
|
-
# online online status (boolean) true
|
127
|
-
# track_count number of public tracks 4
|
128
|
-
# playlist_count number of public playlists 5
|
129
|
-
# followers_count number of followers 54
|
130
|
-
# followings_count number of followed users 75
|
131
|
-
# public_favorites_count number of favorited public tracks 7
|
132
|
-
def users(*args); super; end
|
133
39
|
|
40
|
+
## groups
|
41
|
+
#
|
42
|
+
# @param: Hash[:any number of parameters from list below]
|
43
|
+
# @return: Hash[Json response]
|
44
|
+
#
|
45
|
+
# This is a direct endpoint method to the Soundcloud Groups API. You can pass any
|
46
|
+
# number of attributes to it that are available from the Soundcloud documentation.
|
47
|
+
# As well as documented below in the possible parameters list
|
48
|
+
#
|
49
|
+
# Optional parameters, ideally you should choose at least one:
|
50
|
+
# id integer ID 123
|
51
|
+
# uri API resource URL http://api.soundcloud.com/comments/32562
|
52
|
+
# created_at timestamp of creation "2009/08/13 18:30:10 +0000"
|
53
|
+
# permalink permalink of the resource "summer-of-69"
|
54
|
+
# permalink_url URL to the SoundCloud.com page "http://soundcloud.com/bryan/summer-of-69"
|
55
|
+
# artwork_url URL to a JPEG image "http://i1.sndcdn.com/a....-large.jpg?142a848"
|
56
|
+
# name name of the group "Field Recordings"
|
57
|
+
# description description of the group "field recordings from across the world"
|
58
|
+
# short_description short description of the group "field recordings!"
|
59
|
+
# creator mini user representation of the owner {id: 343, username: "Doctor Wilson"...}
|
60
|
+
def groups(*args)
|
61
|
+
super
|
62
|
+
end
|
63
|
+
|
64
|
+
## playlists
|
65
|
+
#
|
66
|
+
# @param: Hash[:any number of parameters from list below]
|
67
|
+
# @return: Hash[Json response]
|
68
|
+
#
|
69
|
+
# This is a direct endpoint method to the Soundcloud Playlists API. You can pass any
|
70
|
+
# number of attributes to it that are available from the Soundcloud documentation.
|
71
|
+
# As well as documented below in the possible parameters list
|
72
|
+
#
|
73
|
+
# Optional parameters, ideally you should choose at least one:
|
74
|
+
# id integer ID 123
|
75
|
+
# created_at timestamp of creation "2009/08/13 18:30:10 +0000"
|
76
|
+
# user-id user-id of the owner 343
|
77
|
+
# user mini user representation of the owner {id: 343, username: "Doctor Wilson"...}
|
78
|
+
# title track title "Summer of 69"
|
79
|
+
# permalink permalink of the resource "summer-of-69"
|
80
|
+
# permalink_url URL to the SoundCloud.com page "http://soundcloud.com/bryan/summer-of-69"
|
81
|
+
# uri API resource URL "http://api.soundcloud.com/tracks/123"
|
82
|
+
# sharing public/private sharing "public"
|
83
|
+
# purchase_url external purchase link "http://amazon.com/buy/a43aj0b03"
|
84
|
+
# artwork_url URL to a JPEG image "http://i1.sndcdn.com/a....-large.jpg?142a848"
|
85
|
+
# description HTML description "my first track"
|
86
|
+
# downloadable downloadable (boolean) false
|
87
|
+
# streamable streamable via API (boolean) true
|
88
|
+
# label label mini user object {id:123, username: "BeatLabel"...}
|
89
|
+
# duration duration in milliseconds 1203400
|
90
|
+
# genre genre "HipHop"
|
91
|
+
# shared_to_count number of sharings (if private) 45
|
92
|
+
# tag_list list of tags "tag1 \"hip hop\" geo:lat=32.444 geo:lon=55.33"
|
93
|
+
# label_id id of the label user 54677
|
94
|
+
# label_name label name "BeatLabel"
|
95
|
+
# license creative common license "no-rights-reserved"
|
96
|
+
# release release number 3234
|
97
|
+
# release_day day of the release 21
|
98
|
+
# release_month month of the release 5
|
99
|
+
# release_year year of the release 2001
|
100
|
+
# ean EAN identifier for the playlist "123-4354345-43"
|
101
|
+
# playlist_type playlist type "recording"
|
102
|
+
def playlists(*args)
|
103
|
+
super
|
104
|
+
end
|
105
|
+
|
106
|
+
## tracks
|
107
|
+
#
|
108
|
+
# @param: Hash[:any number of parameters from list below]
|
109
|
+
# @return: Hash[Json response]
|
110
|
+
#
|
111
|
+
# This is a direct endpoint method to the Soundcloud Tracks API. You can pass any
|
112
|
+
# number of attributes to it that are available from the Soundcloud documentation.
|
113
|
+
# As well as documented below in the possible parameters list
|
114
|
+
#
|
115
|
+
# Optional parameters, ideally you should choose at least one:
|
116
|
+
# id integer ID 123
|
117
|
+
# created_at timestamp of creation "2009/08/13 18:30:10 +0000"
|
118
|
+
# user-id user-id of the owner 343
|
119
|
+
# user mini user representation of the owner {id: 343, username: "Doctor Wilson"...}
|
120
|
+
# title track title "Summer of 69"
|
121
|
+
# permalink permalink of the resource "summer-of-69"
|
122
|
+
# permalink_url URL to the SoundCloud.com page "http://soundcloud.com/bryan/summer-of-69"
|
123
|
+
# uri API resource URL "http://api.soundcloud.com/tracks/123"
|
124
|
+
# sharing public/private sharing "public"
|
125
|
+
# purchase_url external purchase link "http://amazon.com/buy/a43aj0b03"
|
126
|
+
# artwork_url URL to a JPEG image "http://i1.sndcdn.com/a....-large.jpg?142a848"
|
127
|
+
# description HTML description "my first track"
|
128
|
+
# downloadable downloadable (boolean) false
|
129
|
+
# streamable streamable via API (boolean) true
|
130
|
+
# label label mini user object {id:123, username: "BeatLabel"...}
|
131
|
+
# duration duration in milliseconds 1203400
|
132
|
+
# genre genre "HipHop"
|
133
|
+
# shared_to_count number of sharings (if private) 45
|
134
|
+
# tag_list list of tags "tag1 \"hip hop\" geo:lat=32.444 geo:lon=55.33"
|
135
|
+
# label_id id of the label user 54677
|
136
|
+
# label_name label name "BeatLabel"
|
137
|
+
# license creative common license "no-rights-reserved"
|
138
|
+
# release release number 3234
|
139
|
+
# release_day day of the release 21
|
140
|
+
# release_month month of the release 5
|
141
|
+
# release_year year of the release 2001
|
142
|
+
# state encoding state "finished"
|
143
|
+
# track_type track type "recording"
|
144
|
+
# waveform_url URL to PNG waveform image "http://w1.sndcdn.com/fxguEjG4ax6B_m.png"
|
145
|
+
# download_url URL to original file "http://api.soundcloud.com/tracks/3/download"
|
146
|
+
# stream_url link to 128kbs mp3 stream "http://api.soundcloud.com/tracks/3/stream"
|
147
|
+
# bpm beats per minute 120
|
148
|
+
# commentable track commentable (boolean) true
|
149
|
+
# isrc track ISRC "I123-545454"
|
150
|
+
# key_signature track key "Cmaj"
|
151
|
+
# comment_count track comment count 12
|
152
|
+
# download_count track download count 45
|
153
|
+
# playback_count track play count 435
|
154
|
+
# favoritings_count track favoriting count 6
|
155
|
+
# original_format file format of the original file "aiff"
|
156
|
+
# created_with the app that the track created {"id"=>3434, "..."=>nil}
|
157
|
+
# asset_data binary data of the audio file (only for uploading)
|
158
|
+
# artwork_data binary data of the artwork image (only for uploading)
|
159
|
+
# user_favorite track favorite of current user (boolean, authenticated requests only) 1
|
160
|
+
def tracks(*args)
|
161
|
+
super
|
162
|
+
end
|
163
|
+
|
164
|
+
## users
|
165
|
+
#
|
166
|
+
# @param: Hash[:any number of parameters from list below]
|
167
|
+
# @return: Hash[Json response]
|
168
|
+
#
|
169
|
+
# This is a direct endpoint method to the Soundcloud Users API. You can pass any
|
170
|
+
# number of attributes to it that are available from the Soundcloud documentation.
|
171
|
+
# As well as documented below in the possible parameters list
|
172
|
+
#
|
173
|
+
# Optional parameters, ideally you should choose at least one:
|
174
|
+
# id integer ID 123
|
175
|
+
# permalink permalink of the resource "summer-of-69"
|
176
|
+
# username username "Doctor Wilson"
|
177
|
+
# uri API resource URL http://api.soundcloud.com/comments/32562
|
178
|
+
# permalink_url URL to the SoundCloud.com page "http://soundcloud.com/bryan/summer-of-69"
|
179
|
+
# avatar_url URL to a JPEG image "http://i1.sndcdn.com/a....-large.jpg?142a848"
|
180
|
+
# country country "Germany"
|
181
|
+
# full_name first and last name "Tom Wilson"
|
182
|
+
# city city "Berlin"
|
183
|
+
# description description "Another brick in the wall"
|
184
|
+
# discogs-name Discogs name "myrandomband"
|
185
|
+
# myspace-name MySpace name "myrandomband"
|
186
|
+
# website a URL to the website "http://facebook.com/myrandomband"
|
187
|
+
# website-title a custom title for the website "myrandomband on Facebook"
|
188
|
+
# online online status (boolean) true
|
189
|
+
# track_count number of public tracks 4
|
190
|
+
# playlist_count number of public playlists 5
|
191
|
+
# followers_count number of followers 54
|
192
|
+
# followings_count number of followed users 75
|
193
|
+
# public_favorites_count number of favorited public tracks 7
|
194
|
+
def users(*args)
|
195
|
+
super
|
196
|
+
end
|
197
|
+
|
198
|
+
## method_missing
|
199
|
+
#
|
200
|
+
# @param: Symbol[representation of the method name being called]
|
201
|
+
# @param: Hash[any parameter that is an option to be sent to the API]
|
202
|
+
# @param: Block[optional and not currently being used]
|
203
|
+
#
|
204
|
+
# We use this method to dynamically call the API to minimize code re writing. This method expects
|
205
|
+
# that you will be suitable to receive JSON only. Optionally could add support for other formats later
|
134
206
|
def method_missing(sym, *args, &block)
|
135
|
-
options
|
136
|
-
response
|
207
|
+
options = args.extract_options!.merge(:client_id => api_key)
|
208
|
+
response = conn.get("/#{sym.to_s}.json") { |req| req.params = options }
|
137
209
|
args.nil? ? response.body.send(sym) : response.body
|
138
210
|
end
|
139
211
|
end
|
140
|
-
|
212
|
+
|
141
213
|
autoload :Comments, "soundcloud2/comments"
|
142
214
|
autoload :Groups, "soundcloud2/groups"
|
143
215
|
autoload :Playlists, "soundcloud2/playlists"
|
144
216
|
autoload :Tracks, "soundcloud2/tracks"
|
145
217
|
autoload :Users, "soundcloud2/users"
|
146
|
-
end
|
218
|
+
end
|
data/lib/soundcloud2/comments.rb
CHANGED
@@ -9,10 +9,13 @@ module Soundcloud2
|
|
9
9
|
|
10
10
|
# GET /comments/{id} a group
|
11
11
|
def comments(*args)
|
12
|
-
|
13
|
-
|
14
|
-
args.nil? ? response.body.send(sym) : response.body
|
15
|
-
end
|
12
|
+
super
|
13
|
+
end
|
16
14
|
|
15
|
+
def method_missing(sym, *args, &block)
|
16
|
+
options = args.extract_options!.merge(:client_id => api_key)
|
17
|
+
response = conn.get("/#{sym.to_s}/#{args[0]}.json") { |req| req.params = options }
|
18
|
+
args.nil? ? response.body.send(sym) : response.body
|
19
|
+
end
|
17
20
|
end
|
18
|
-
end
|
21
|
+
end
|
data/lib/soundcloud2/groups.rb
CHANGED
@@ -48,5 +48,9 @@ module Soundcloud2
|
|
48
48
|
response = conn.get("/groups/#{args[0]}/tracks.json") { |req| req.params = options }
|
49
49
|
args.nil? ? response.body.send(sym) : response.body
|
50
50
|
end
|
51
|
+
|
52
|
+
def method_missing(sym, *args, &block)
|
53
|
+
options = args.extract_options!.merge(:client_id => api_key)
|
54
|
+
end
|
51
55
|
end
|
52
|
-
end
|
56
|
+
end
|
data/lib/soundcloud2/tracks.rb
CHANGED
data/lib/soundcloud2/users.rb
CHANGED
@@ -61,22 +61,32 @@ module Soundcloud2
|
|
61
61
|
|
62
62
|
# GET /users/{id}/groups list of joined groups
|
63
63
|
def users_groups(*args)
|
64
|
-
|
64
|
+
options = args.extract_options!.merge(:client_id => api_key)
|
65
65
|
response = conn.get("/users/#{args[0]}/groups.json") { |req| req.params = options }
|
66
66
|
args.nil? ? response.body.send(sym) : response.body
|
67
67
|
end
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
69
|
+
#def method_missing(sym, *args, &block)
|
70
|
+
# options = args.extrac_options!.merge(:client_id => api_key)
|
71
|
+
# method = sym.to_s.gsub(/_(.*)$/, '')
|
72
|
+
# action = sym.to_s.gsub(/^(.*)_/, '')
|
73
|
+
# param1 = args[0]
|
74
|
+
# param2 = args.try(:[], 1).nil? ? ".json" : "/#{args[1]}.json"
|
75
|
+
#
|
76
|
+
# response = conn.get("/#{method}/#{param1}/#{action}#{param2}"
|
77
|
+
# args.nil? ? response.body.send(sym) : response.body
|
78
|
+
#end
|
79
|
+
|
80
|
+
#def method_missing(sym, *args, &block)
|
81
|
+
# options = args.extract_options!.merge(:client_id => api_key)
|
82
|
+
# if sym.to_s == "users"
|
83
|
+
# response = conn.get("/users/#{args[0]}.json") { |req| req.params = options }
|
84
|
+
# elsif args[1].nil?
|
85
|
+
# response = conn.get("/users/#{args[0]}.json") { |req| req.params = options }
|
86
|
+
# else
|
87
|
+
# response = conn.get("/users/#{args[0]}/#{sym.to_s}/#{args[1]}.json") { |req| req.params = options }
|
88
|
+
# end
|
89
|
+
# args.nil? ? response.body.send(sym) : response.body
|
90
|
+
#end
|
81
91
|
end
|
82
|
-
end
|
92
|
+
end
|