echonest-ruby-api 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -1
- data/Gemfile.lock +1 -1
- data/doc/Biography.html +368 -0
- data/doc/Blog.html +422 -0
- data/doc/Echonest.html +129 -0
- data/doc/Echonest/Artist.html +839 -0
- data/doc/Echonest/Base.html +471 -0
- data/doc/Echonest/Base/EchonestConnectionError.html +123 -0
- data/doc/_index.html +157 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +328 -0
- data/doc/file.README.html +128 -0
- data/doc/file_list.html +55 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +128 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +252 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/base.rb +19 -1
- data/lib/echonest-ruby-api/version.rb +1 -1
- data/pkg/echonest-ruby-api-0.0.4.gem +0 -0
- metadata +24 -4
- data/lib/echonest-ruby-api/news.rb +0 -26
- data/lib/news.rb +0 -4
@@ -0,0 +1,471 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Echonest::Base
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.4.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (B)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Echonest.html" title="Echonest (module)">Echonest</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Base</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Echonest::Base
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Echonest::Base</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/base.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<div id="subclasses">
|
103
|
+
<h2>Direct Known Subclasses</h2>
|
104
|
+
<p class="children"><span class='object_link'><a href="Artist.html" title="Echonest::Artist (class)">Artist</a></span></p>
|
105
|
+
</div>
|
106
|
+
<h2>Defined Under Namespace</h2>
|
107
|
+
<p class="children">
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Base/EchonestConnectionError.html" title="Echonest::Base::EchonestConnectionError (class)">EchonestConnectionError</a></span>
|
113
|
+
|
114
|
+
|
115
|
+
</p>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<h2>
|
125
|
+
Class Method Summary
|
126
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
127
|
+
</h2>
|
128
|
+
|
129
|
+
<ul class="summary">
|
130
|
+
|
131
|
+
<li class="public ">
|
132
|
+
<span class="summary_signature">
|
133
|
+
|
134
|
+
<a href="#base_uri-class_method" title="base_uri (class method)">+ (Object) <strong>base_uri</strong> </a>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
</span>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<span class="summary_desc"><div class='inline'>
|
149
|
+
<p>Gets the base URI for all API calls.</p>
|
150
|
+
</div></span>
|
151
|
+
|
152
|
+
</li>
|
153
|
+
|
154
|
+
|
155
|
+
<li class="public ">
|
156
|
+
<span class="summary_signature">
|
157
|
+
|
158
|
+
<a href="#version-class_method" title="version (class method)">+ (Object) <strong>version</strong> </a>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
</span>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<span class="summary_desc"><div class='inline'>
|
173
|
+
<p>The current version of the Echonest API to be supported.</p>
|
174
|
+
</div></span>
|
175
|
+
|
176
|
+
</li>
|
177
|
+
|
178
|
+
|
179
|
+
</ul>
|
180
|
+
|
181
|
+
<h2>
|
182
|
+
Instance Method Summary
|
183
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
184
|
+
</h2>
|
185
|
+
|
186
|
+
<ul class="summary">
|
187
|
+
|
188
|
+
<li class="public ">
|
189
|
+
<span class="summary_signature">
|
190
|
+
|
191
|
+
<a href="#get-instance_method" title="#get (instance method)">- (Object) <strong>get</strong>(endpoint, options = {}) </a>
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
</span>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
<span class="summary_desc"><div class='inline'>
|
206
|
+
<p>Performs a simple HTTP get on an API endpoint.</p>
|
207
|
+
</div></span>
|
208
|
+
|
209
|
+
</li>
|
210
|
+
|
211
|
+
|
212
|
+
<li class="public ">
|
213
|
+
<span class="summary_signature">
|
214
|
+
|
215
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Base) <strong>initialize</strong>(api_key) </a>
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
</span>
|
220
|
+
|
221
|
+
|
222
|
+
<span class="note title constructor">constructor</span>
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
<span class="summary_desc"><div class='inline'>
|
232
|
+
<p>A new instance of Base.</p>
|
233
|
+
</div></span>
|
234
|
+
|
235
|
+
</li>
|
236
|
+
|
237
|
+
|
238
|
+
</ul>
|
239
|
+
|
240
|
+
|
241
|
+
<div id="constructor_details" class="method_details_list">
|
242
|
+
<h2>Constructor Details</h2>
|
243
|
+
|
244
|
+
<div class="method_details first">
|
245
|
+
<h3 class="signature first" id="initialize-instance_method">
|
246
|
+
|
247
|
+
- (<tt><span class='object_link'><a href="" title="Echonest::Base (class)">Base</a></span></tt>) <strong>initialize</strong>(api_key)
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
</h3><div class="docstring">
|
254
|
+
<div class="discussion">
|
255
|
+
|
256
|
+
<p>A new instance of Base</p>
|
257
|
+
|
258
|
+
|
259
|
+
</div>
|
260
|
+
</div>
|
261
|
+
<div class="tags">
|
262
|
+
|
263
|
+
|
264
|
+
</div><table class="source_code">
|
265
|
+
<tr>
|
266
|
+
<td>
|
267
|
+
<pre class="lines">
|
268
|
+
|
269
|
+
|
270
|
+
10
|
271
|
+
11
|
272
|
+
12
|
273
|
+
13</pre>
|
274
|
+
</td>
|
275
|
+
<td>
|
276
|
+
<pre class="code"><span class="info file"># File 'lib/base.rb', line 10</span>
|
277
|
+
|
278
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_api_key'>api_key</span><span class='rparen'>)</span>
|
279
|
+
<span class='ivar'>@api_key</span> <span class='op'>=</span> <span class='id identifier rubyid_api_key'>api_key</span>
|
280
|
+
<span class='ivar'>@base_uri</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>http://developer.echonest.com/api/v4/</span><span class='tstring_end'>"</span></span>
|
281
|
+
<span class='kw'>end</span></pre>
|
282
|
+
</td>
|
283
|
+
</tr>
|
284
|
+
</table>
|
285
|
+
</div>
|
286
|
+
|
287
|
+
</div>
|
288
|
+
|
289
|
+
|
290
|
+
<div id="class_method_details" class="method_details_list">
|
291
|
+
<h2>Class Method Details</h2>
|
292
|
+
|
293
|
+
|
294
|
+
<div class="method_details first">
|
295
|
+
<h3 class="signature first" id="base_uri-class_method">
|
296
|
+
|
297
|
+
+ (<tt>Object</tt>) <strong>base_uri</strong>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
</h3><div class="docstring">
|
304
|
+
<div class="discussion">
|
305
|
+
|
306
|
+
<p>Gets the base URI for all API calls</p>
|
307
|
+
|
308
|
+
<p>Returns a String</p>
|
309
|
+
|
310
|
+
|
311
|
+
</div>
|
312
|
+
</div>
|
313
|
+
<div class="tags">
|
314
|
+
|
315
|
+
|
316
|
+
</div><table class="source_code">
|
317
|
+
<tr>
|
318
|
+
<td>
|
319
|
+
<pre class="lines">
|
320
|
+
|
321
|
+
|
322
|
+
18
|
323
|
+
19
|
324
|
+
20</pre>
|
325
|
+
</td>
|
326
|
+
<td>
|
327
|
+
<pre class="code"><span class="info file"># File 'lib/base.rb', line 18</span>
|
328
|
+
|
329
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_base_uri'>base_uri</span>
|
330
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>http://developer.echonest.com/api/v</span><span class='embexpr_beg'>#{</span> <span class='const'>Base</span><span class='period'>.</span><span class='id identifier rubyid_version'>version</span> <span class='rbrace'>}</span><span class='tstring_content'>/</span><span class='tstring_end'>"</span></span>
|
331
|
+
<span class='kw'>end</span></pre>
|
332
|
+
</td>
|
333
|
+
</tr>
|
334
|
+
</table>
|
335
|
+
</div>
|
336
|
+
|
337
|
+
<div class="method_details ">
|
338
|
+
<h3 class="signature " id="version-class_method">
|
339
|
+
|
340
|
+
+ (<tt>Object</tt>) <strong>version</strong>
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
</h3><div class="docstring">
|
347
|
+
<div class="discussion">
|
348
|
+
|
349
|
+
<p>The current version of the Echonest API to be supported.</p>
|
350
|
+
|
351
|
+
<p>Returns a Fixnum</p>
|
352
|
+
|
353
|
+
|
354
|
+
</div>
|
355
|
+
</div>
|
356
|
+
<div class="tags">
|
357
|
+
|
358
|
+
|
359
|
+
</div><table class="source_code">
|
360
|
+
<tr>
|
361
|
+
<td>
|
362
|
+
<pre class="lines">
|
363
|
+
|
364
|
+
|
365
|
+
25
|
366
|
+
26
|
367
|
+
27</pre>
|
368
|
+
</td>
|
369
|
+
<td>
|
370
|
+
<pre class="code"><span class="info file"># File 'lib/base.rb', line 25</span>
|
371
|
+
|
372
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_version'>version</span>
|
373
|
+
<span class='int'>4</span>
|
374
|
+
<span class='kw'>end</span></pre>
|
375
|
+
</td>
|
376
|
+
</tr>
|
377
|
+
</table>
|
378
|
+
</div>
|
379
|
+
|
380
|
+
</div>
|
381
|
+
|
382
|
+
<div id="instance_method_details" class="method_details_list">
|
383
|
+
<h2>Instance Method Details</h2>
|
384
|
+
|
385
|
+
|
386
|
+
<div class="method_details first">
|
387
|
+
<h3 class="signature first" id="get-instance_method">
|
388
|
+
|
389
|
+
- (<tt>Object</tt>) <strong>get</strong>(endpoint, options = {})
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
</h3><div class="docstring">
|
396
|
+
<div class="discussion">
|
397
|
+
|
398
|
+
<p>Performs a simple HTTP get on an API endpoint.</p>
|
399
|
+
|
400
|
+
<p>Examples:</p>
|
401
|
+
|
402
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>artist/biographies</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>results:</span> <span class='int'>10</span><span class='rparen'>)</span>
|
403
|
+
<span class='comment'>#=> Array of Biography objects.</span></code></pre>
|
404
|
+
|
405
|
+
<p>Raises an <tt>ArgumentError</tt> if the Echonest API responds with an
|
406
|
+
error.</p>
|
407
|
+
<ul><li>
|
408
|
+
<p><tt>endpoint</tt> - The name of an API endpoint as a String</p>
|
409
|
+
</li><li>
|
410
|
+
<p><tt>options</tt> - A Hash of options to pass to the end point.</p>
|
411
|
+
</li></ul>
|
412
|
+
|
413
|
+
<p>Returns a response as a Hash</p>
|
414
|
+
|
415
|
+
|
416
|
+
</div>
|
417
|
+
</div>
|
418
|
+
<div class="tags">
|
419
|
+
|
420
|
+
|
421
|
+
</div><table class="source_code">
|
422
|
+
<tr>
|
423
|
+
<td>
|
424
|
+
<pre class="lines">
|
425
|
+
|
426
|
+
|
427
|
+
42
|
428
|
+
43
|
429
|
+
44
|
430
|
+
45
|
431
|
+
46
|
432
|
+
47
|
433
|
+
48
|
434
|
+
49
|
435
|
+
50
|
436
|
+
51
|
437
|
+
52
|
438
|
+
53</pre>
|
439
|
+
</td>
|
440
|
+
<td>
|
441
|
+
<pre class="code"><span class="info file"># File 'lib/base.rb', line 42</span>
|
442
|
+
|
443
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_endpoint'>endpoint</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
444
|
+
<span class='id identifier rubyid_query_string'>query_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
445
|
+
<span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
|
446
|
+
<span class='id identifier rubyid_query_string'>query_string</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_key'>key</span> <span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_value'>value</span> <span class='rbrace'>}</span><span class='tstring_content'>&</span><span class='tstring_end'>"</span></span>
|
447
|
+
<span class='kw'>end</span>
|
448
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='const'>HTTParty</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span> <span class='const'>Base</span><span class='period'>.</span><span class='id identifier rubyid_base_uri'>base_uri</span> <span class='rbrace'>}</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_endpoint'>endpoint</span> <span class='rbrace'>}</span><span class='tstring_content'>?api_key=</span><span class='embexpr_beg'>#{</span> <span class='ivar'>@api_key</span> <span class='rbrace'>}</span><span class='tstring_content'>&format=json&</span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_query_string'>query_string</span> <span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
449
|
+
<span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='const'>MultiJson</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='comma'>,</span> <span class='label'>symbolize_keys:</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
450
|
+
<span class='id identifier rubyid_response_code'>response_code</span> <span class='op'>=</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='symbol'>:response</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:status</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:code</span><span class='rbracket'>]</span>
|
451
|
+
|
452
|
+
<span class='id identifier rubyid_response_code'>response_code</span><span class='period'>.</span><span class='id identifier rubyid_eql?'>eql?</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='symbol'>:response</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Error code </span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_response_code'>response_code</span> <span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
453
|
+
|
454
|
+
<span class='kw'>end</span></pre>
|
455
|
+
</td>
|
456
|
+
</tr>
|
457
|
+
</table>
|
458
|
+
</div>
|
459
|
+
|
460
|
+
</div>
|
461
|
+
|
462
|
+
</div>
|
463
|
+
|
464
|
+
<div id="footer">
|
465
|
+
Generated on Sun Feb 10 11:33:24 2013 by
|
466
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
467
|
+
0.8.4.1 (ruby-1.9.3).
|
468
|
+
</div>
|
469
|
+
|
470
|
+
</body>
|
471
|
+
</html>
|