soundcloud-ruby-api-wrapper 0.2.1 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/VERSION.yml +1 -1
  2. data/lib/soundcloud/models/track.rb +24 -12
  3. data/lib/soundcloud.rb +1 -2
  4. data/ruby-api-wrapper.gemspec +2 -33
  5. data/spec/soundcloud_comment_spec.rb +1 -1
  6. data/spec/soundcloud_event_spec.rb +1 -1
  7. data/spec/soundcloud_playlist_spec.rb +1 -2
  8. data/spec/soundcloud_spec.rb +1 -1
  9. data/spec/soundcloud_track_spec.rb +19 -4
  10. data/spec/soundcloud_user_spec.rb +1 -1
  11. metadata +2 -33
  12. data/doc/classes/Soundcloud/Models/Comment.html +0 -197
  13. data/doc/classes/Soundcloud/Models/Comment.src/M000007.html +0 -22
  14. data/doc/classes/Soundcloud/Models/Event.html +0 -190
  15. data/doc/classes/Soundcloud/Models/Event.src/M000009.html +0 -18
  16. data/doc/classes/Soundcloud/Models/Playlist.html +0 -220
  17. data/doc/classes/Soundcloud/Models/Playlist.src/M000009.html +0 -20
  18. data/doc/classes/Soundcloud/Models/Playlist.src/M000010.html +0 -20
  19. data/doc/classes/Soundcloud/Models/Track.html +0 -348
  20. data/doc/classes/Soundcloud/Models/Track.src/M000003.html +0 -29
  21. data/doc/classes/Soundcloud/Models/Track.src/M000004.html +0 -18
  22. data/doc/classes/Soundcloud/Models/Track.src/M000005.html +0 -22
  23. data/doc/classes/Soundcloud/Models/Track.src/M000006.html +0 -28
  24. data/doc/classes/Soundcloud/Models/User.html +0 -284
  25. data/doc/classes/Soundcloud/Models/User.src/M000008.html +0 -18
  26. data/doc/classes/Soundcloud/Models.html +0 -135
  27. data/doc/classes/Soundcloud.html +0 -213
  28. data/doc/classes/Soundcloud.src/M000001.html +0 -24
  29. data/doc/classes/Soundcloud.src/M000002.html +0 -19
  30. data/doc/created.rid +0 -1
  31. data/doc/files/lib/soundcloud/models/base_rb.html +0 -101
  32. data/doc/files/lib/soundcloud/models/comment_rb.html +0 -101
  33. data/doc/files/lib/soundcloud/models/event_rb.html +0 -101
  34. data/doc/files/lib/soundcloud/models/playlist_rb.html +0 -101
  35. data/doc/files/lib/soundcloud/models/track_rb.html +0 -101
  36. data/doc/files/lib/soundcloud/models/user_rb.html +0 -101
  37. data/doc/files/lib/soundcloud_rb.html +0 -127
  38. data/doc/fr_class_index.html +0 -33
  39. data/doc/fr_file_index.html +0 -33
  40. data/doc/fr_method_index.html +0 -36
  41. data/doc/index.html +0 -24
  42. data/doc/rdoc-style.css +0 -208
@@ -1,20 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>new (Soundcloud::Models::Playlist)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/soundcloud/models/playlist.rb, line 52</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
15
- <span class="ruby-keyword kw">super</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
16
- <span class="ruby-comment cmt">#create empty tracks array if not existing</span>
17
- <span class="ruby-identifier">attributes</span>[<span class="ruby-value str">'tracks'</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tracks?</span>
18
- <span class="ruby-keyword kw">end</span></pre>
19
- </body>
20
- </html>
@@ -1,20 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>new (Soundcloud::Models::Playlist)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/soundcloud/models/playlist.rb, line 46</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
15
- <span class="ruby-keyword kw">super</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
16
- <span class="ruby-comment cmt">#create empty tracks array if not existing</span>
17
- <span class="ruby-identifier">attributes</span>[<span class="ruby-value str">'tracks'</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tracks?</span>
18
- <span class="ruby-keyword kw">end</span></pre>
19
- </body>
20
- </html>
@@ -1,348 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: Soundcloud::Models::Track</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">Soundcloud::Models::Track</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../files/lib/soundcloud/models/track_rb.html">
59
- lib/soundcloud/models/track.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- Base
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
- <div id="description">
82
- <p>
83
- Look up the resource attributes and filtering usage here:
84
- </p>
85
- <p>
86
- SC API Attributes (as of 26/05/09):
87
- </p>
88
- <ul>
89
- <li>id
90
-
91
- </li>
92
- <li>user_id
93
-
94
- </li>
95
- <li>permalink
96
-
97
- </li>
98
- <li>description
99
-
100
- </li>
101
- <li>sharing
102
-
103
- </li>
104
- <li>bpm
105
-
106
- </li>
107
- <li>comments_count
108
-
109
- </li>
110
- <li>created_at
111
-
112
- </li>
113
- <li>downloadable
114
-
115
- </li>
116
- <li>downloads_count
117
-
118
- </li>
119
- <li>duration
120
-
121
- </li>
122
- <li>genre
123
-
124
- </li>
125
- <li>streamable
126
-
127
- </li>
128
- <li>uri
129
-
130
- </li>
131
- <li>user (overwritten by wrapper)
132
-
133
- </li>
134
- <li>permalink_url
135
-
136
- </li>
137
- <li>playback_count
138
-
139
- </li>
140
- <li>artwork_url
141
-
142
- </li>
143
- <li>waveform_url
144
-
145
- </li>
146
- <li>purchase_url
147
-
148
- </li>
149
- <li>stream_url
150
-
151
- </li>
152
- <li>user_playback_count
153
-
154
- </li>
155
- <li>user_favorite
156
-
157
- </li>
158
- </ul>
159
- <p>
160
- Custom Wrapper Attributes/Methods:
161
- </p>
162
- <ul>
163
- <li>user
164
-
165
- </li>
166
- <li>permissions
167
-
168
- </li>
169
- <li>comments
170
-
171
- </li>
172
- <li>is_favorite?
173
-
174
- </li>
175
- <li>add_favorite!
176
-
177
- </li>
178
- <li>remove_favorite!
179
-
180
- </li>
181
- <li>asset_data (= File.new(&#8217;/your file..&#8217;))
182
-
183
- </li>
184
- </ul>
185
- <p>
186
- Look up the resource attributes and filtering usage here:
187
- </p>
188
- <p>
189
- <a
190
- href="http://wiki.github.com/soundcloud/api/documentation#track">wiki.github.com/soundcloud/api/documentation#track</a>
191
- </p>
192
- <p>
193
- Examples:
194
- </p>
195
- <pre>
196
- some_user = sc_client.User.find('some_user')
197
-
198
- # gets 50 (Soundcloud API limit) tracks from some_user
199
- some_user_tracks = some_user.tracks
200
-
201
- # gets the latest song from some_user_tracks
202
- first_song = some_user_tracks.first
203
-
204
- # prints 50 (Soundcloud API limit) comments of first_song with username, timestamp (can be nil) and comment body
205
- first_song.comments.each do |comment|
206
- if comment.timestamp.nil?
207
- timestamp = &quot;&quot;
208
- else
209
- timestamp = &quot;@#{comment.timestamp/1000}&quot;
210
- end
211
- p &quot;#{comment.user.username} #{timestamp}: #{comment.body}&quot;
212
- end
213
-
214
- # downloads the original track file (track.downloadable must be true)
215
- # (the open call requires the 'open-uri' gem)
216
- downloaded_file = open first_song.download_url
217
-
218
- # gets 50 (Soundcloud API limit) tracks with a BPM &lt;= 100
219
- slow_tracks = sc_client.Track.find(:all, :params =&gt; { &quot;bpm[to]&quot; =&gt; &quot;100&quot;} )
220
-
221
- # create a new Track on Soundcloud with some_sound_file.mp3 as asset data
222
- new_track = sc_client.Track.new
223
- new_track.title = 'New Track'
224
- new_track.sharing = 'private'
225
- new_track.asset_data = File.new('some_sound_file.wav')
226
- new_track.save
227
-
228
- # gives some_user permission to access the new_track
229
- new_track.permissions &lt;&lt; some_user
230
- new_track.permissions.save
231
- </pre>
232
-
233
- </div>
234
-
235
-
236
- </div>
237
-
238
- <div id="method-list">
239
- <h3 class="section-bar">Methods</h3>
240
-
241
- <div class="name-list">
242
- <a href="#M000006">create</a>&nbsp;&nbsp;
243
- <a href="#M000003">download_url</a>&nbsp;&nbsp;
244
- <a href="#M000004">set_asset_data</a>&nbsp;&nbsp;
245
- <a href="#M000005">update</a>&nbsp;&nbsp;
246
- </div>
247
- </div>
248
-
249
- </div>
250
-
251
-
252
- <!-- if includes -->
253
-
254
- <div id="section">
255
-
256
-
257
-
258
-
259
-
260
- <div id="attribute-list">
261
- <h3 class="section-bar">Attributes</h3>
262
-
263
- <div class="name-list">
264
- <table>
265
- <tr class="top-aligned-row context-row">
266
- <td class="context-item-name">asset_data</td>
267
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
268
- <td class="context-item-desc"></td>
269
- </tr>
270
- </table>
271
- </div>
272
- </div>
273
-
274
-
275
-
276
- <!-- if method_list -->
277
- <div id="methods">
278
- <h3 class="section-bar">Public Instance methods</h3>
279
-
280
- <div id="method-M000006" class="method-detail">
281
- <a name="M000006"></a>
282
-
283
- <div class="method-heading">
284
- <a href="Track.src/M000006.html" target="Code" class="method-signature"
285
- onclick="popupCode('Track.src/M000006.html');return false;">
286
- <span class="method-name">create</span><span class="method-args">()</span>
287
- </a>
288
- </div>
289
-
290
- <div class="method-description">
291
- </div>
292
- </div>
293
-
294
- <div id="method-M000003" class="method-detail">
295
- <a name="M000003"></a>
296
-
297
- <div class="method-heading">
298
- <a href="Track.src/M000003.html" target="Code" class="method-signature"
299
- onclick="popupCode('Track.src/M000003.html');return false;">
300
- <span class="method-name">download_url</span><span class="method-args">()</span>
301
- </a>
302
- </div>
303
-
304
- <div class="method-description">
305
- </div>
306
- </div>
307
-
308
- <div id="method-M000004" class="method-detail">
309
- <a name="M000004"></a>
310
-
311
- <div class="method-heading">
312
- <a href="Track.src/M000004.html" target="Code" class="method-signature"
313
- onclick="popupCode('Track.src/M000004.html');return false;">
314
- <span class="method-name">set_asset_data</span><span class="method-args">(file)</span>
315
- </a>
316
- </div>
317
-
318
- <div class="method-description">
319
- </div>
320
- </div>
321
-
322
- <div id="method-M000005" class="method-detail">
323
- <a name="M000005"></a>
324
-
325
- <div class="method-heading">
326
- <a href="Track.src/M000005.html" target="Code" class="method-signature"
327
- onclick="popupCode('Track.src/M000005.html');return false;">
328
- <span class="method-name">update</span><span class="method-args">()</span>
329
- </a>
330
- </div>
331
-
332
- <div class="method-description">
333
- </div>
334
- </div>
335
-
336
-
337
- </div>
338
-
339
-
340
- </div>
341
-
342
-
343
- <div id="validator-badges">
344
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
345
- </div>
346
-
347
- </body>
348
- </html>
@@ -1,29 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>download_url (Soundcloud::Models::Track)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/soundcloud/models/track.rb, line 93</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">download_url</span>
15
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">Exception</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Track is not downloadable'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">downloadable</span>
16
- <span class="ruby-identifier">original_download_url</span> = <span class="ruby-keyword kw">super</span>
17
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sharing</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;private&quot;</span>
18
- <span class="ruby-keyword kw">begin</span>
19
- <span class="ruby-identifier">response</span> = <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">handle_response</span>( <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">oauth_connection</span>.<span class="ruby-identifier">get</span>( <span class="ruby-identifier">original_download_url</span> ) )
20
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">original_download_url</span>
21
- <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Redirection</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">redirection</span>
22
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">redirection</span>.<span class="ruby-identifier">response</span>[<span class="ruby-value str">'Location'</span>]
23
- <span class="ruby-keyword kw">end</span>
24
- <span class="ruby-keyword kw">else</span>
25
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">original_download_url</span>
26
- <span class="ruby-keyword kw">end</span>
27
- <span class="ruby-keyword kw">end</span></pre>
28
- </body>
29
- </html>
@@ -1,18 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>set_asset_data (Soundcloud::Models::Track)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/soundcloud/models/track.rb, line 111</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_asset_data</span>(<span class="ruby-identifier">file</span>)
15
- <span class="ruby-ivar">@asset_data</span> = <span class="ruby-identifier">file</span>
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,22 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>update (Soundcloud::Models::Track)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/soundcloud/models/track.rb, line 115</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>
15
- <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@asset_data</span>.<span class="ruby-identifier">nil?</span>
16
- <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Multipart update is NotImplemented'</span>
17
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">send_multipart_request</span>(<span class="ruby-identifier">:put</span>,<span class="ruby-value str">'/tracks/#{self.id}'</span>,<span class="ruby-value str">'replacement[asset_data]'</span>,<span class="ruby-ivar">@asset_data</span>)
18
- <span class="ruby-keyword kw">end</span>
19
- <span class="ruby-keyword kw">super</span>
20
- <span class="ruby-keyword kw">end</span></pre>
21
- </body>
22
- </html>