tidal 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +164 -9
  3. data/Rakefile +9 -0
  4. data/docs/README_md.html +299 -0
  5. data/docs/Tidal/ClientV1.html +721 -0
  6. data/docs/Tidal/Error.html +97 -0
  7. data/docs/Tidal.html +100 -0
  8. data/docs/created.rid +5 -0
  9. data/docs/css/fonts.css +167 -0
  10. data/docs/css/rdoc.css +687 -0
  11. data/docs/fonts/Lato-Light.ttf +0 -0
  12. data/docs/fonts/Lato-LightItalic.ttf +0 -0
  13. data/docs/fonts/Lato-Regular.ttf +0 -0
  14. data/docs/fonts/Lato-RegularItalic.ttf +0 -0
  15. data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
  16. data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
  17. data/docs/images/add.png +0 -0
  18. data/docs/images/arrow_up.png +0 -0
  19. data/docs/images/brick.png +0 -0
  20. data/docs/images/brick_link.png +0 -0
  21. data/docs/images/bug.png +0 -0
  22. data/docs/images/bullet_black.png +0 -0
  23. data/docs/images/bullet_toggle_minus.png +0 -0
  24. data/docs/images/bullet_toggle_plus.png +0 -0
  25. data/docs/images/date.png +0 -0
  26. data/docs/images/delete.png +0 -0
  27. data/docs/images/find.png +0 -0
  28. data/docs/images/loadingAnimation.gif +0 -0
  29. data/docs/images/macFFBgHack.png +0 -0
  30. data/docs/images/package.png +0 -0
  31. data/docs/images/page_green.png +0 -0
  32. data/docs/images/page_white_text.png +0 -0
  33. data/docs/images/page_white_width.png +0 -0
  34. data/docs/images/plugin.png +0 -0
  35. data/docs/images/ruby.png +0 -0
  36. data/docs/images/tag_blue.png +0 -0
  37. data/docs/images/tag_green.png +0 -0
  38. data/docs/images/transparent.png +0 -0
  39. data/docs/images/wrench.png +0 -0
  40. data/docs/images/wrench_orange.png +0 -0
  41. data/docs/images/zoom.png +0 -0
  42. data/docs/index.html +259 -0
  43. data/docs/js/darkfish.js +97 -0
  44. data/docs/js/navigation.js +105 -0
  45. data/docs/js/navigation.js.gz +0 -0
  46. data/docs/js/search.js +110 -0
  47. data/docs/js/search_index.js +1 -0
  48. data/docs/js/search_index.js.gz +0 -0
  49. data/docs/js/searcher.js +229 -0
  50. data/docs/js/searcher.js.gz +0 -0
  51. data/docs/table_of_contents.html +176 -0
  52. data/lib/tidal/client_v1.rb +111 -1
  53. data/lib/tidal/version.rb +1 -1
  54. metadata +63 -1
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/docs/index.html ADDED
@@ -0,0 +1,259 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>Tidal API Client Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ var index_rel_prefix = "./";
12
+ </script>
13
+
14
+ <script src="./js/navigation.js" defer></script>
15
+ <script src="./js/search.js" defer></script>
16
+ <script src="./js/search_index.js" defer></script>
17
+ <script src="./js/searcher.js" defer></script>
18
+ <script src="./js/darkfish.js" defer></script>
19
+
20
+ <link href="./css/fonts.css" rel="stylesheet">
21
+ <link href="./css/rdoc.css" rel="stylesheet">
22
+
23
+
24
+ <body id="top" role="document" class="file">
25
+ <nav role="navigation">
26
+ <div id="project-navigation">
27
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
28
+ <h2>
29
+ <a href="./index.html" rel="home">Home</a>
30
+ </h2>
31
+
32
+ <div id="table-of-contents-navigation">
33
+ <a href="./table_of_contents.html#pages">Pages</a>
34
+ <a href="./table_of_contents.html#classes">Classes</a>
35
+ <a href="./table_of_contents.html#methods">Methods</a>
36
+ </div>
37
+ </div>
38
+
39
+
40
+ <div id="search-section" role="search" class="project-section initially-hidden">
41
+ <form action="#" method="get" accept-charset="utf-8">
42
+ <div id="search-field-wrapper">
43
+ <input id="search-field" role="combobox" aria-label="Search"
44
+ aria-autocomplete="list" aria-controls="search-results"
45
+ type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
46
+ title="Type to search, Up and Down to navigate, Enter to load">
47
+ </div>
48
+
49
+ <ul id="search-results" aria-label="Search Results"
50
+ aria-busy="false" aria-expanded="false"
51
+ aria-atomic="false" class="initially-hidden"></ul>
52
+ </form>
53
+ </div>
54
+
55
+ </div>
56
+
57
+ <div id="project-metadata">
58
+
59
+ <div id="fileindex-section" class="nav-section">
60
+ <h3>Pages</h3>
61
+
62
+ <ul class="link-list">
63
+ <li><a href="./README_md.html">README</a>
64
+ </ul>
65
+ </div>
66
+
67
+ <div id="classindex-section" class="nav-section">
68
+ <h3>Class and Module Index</h3>
69
+
70
+ <ul class="link-list">
71
+ <li><details open><summary><code><a href="./Tidal.html">Tidal</a></code></summary>
72
+ <ul class="link-list">
73
+ <li><code><a href="./Tidal/ClientV1.html">ClientV1</a></code>
74
+ <li><code><a href="./Tidal/Error.html">Error</a></code>
75
+ </ul></details>
76
+ </div>
77
+
78
+ </div>
79
+ </nav>
80
+
81
+ <main role="main">
82
+
83
+
84
+ <h1 id="label-Tidal"><a href="Tidal.html"><code>Tidal</code></a><span><a href="#label-Tidal">&para;</a> <a href="#top">&uarr;</a></span></h1>
85
+
86
+ <p>A Ruby wrapper to interact with the <a href="Tidal.html"><code>Tidal</code></a> API. This gem provides a Ruby wrapper around the <a href="Tidal.html"><code>Tidal</code></a> API, allowing developers to easily interact with Tidal’s services, including retrieving album and artist information, searching for tracks, and more.</p>
87
+
88
+ <p><img src="https://badge.fury.io/rb/tidal.svg"></p>
89
+
90
+ <h2 id="label-Installation">Installation<span><a href="#label-Installation">&para;</a> <a href="#top">&uarr;</a></span></h2>
91
+
92
+ <p>Add this line to your application’s Gemfile:</p>
93
+
94
+ <pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-string">&#39;tidal&#39;</span>
95
+ </pre>
96
+
97
+ <p>And then execute:</p>
98
+
99
+ <pre>$ bundle install</pre>
100
+
101
+ <p>Or install it yourself as:</p>
102
+
103
+ <pre>$ gem install tidal</pre>
104
+
105
+ <h2 id="label-Usage">Usage<span><a href="#label-Usage">&para;</a> <a href="#top">&uarr;</a></span></h2>
106
+
107
+ <h3 id="label-Configuration">Configuration<span><a href="#label-Configuration">&para;</a> <a href="#top">&uarr;</a></span></h3>
108
+
109
+ <p>First, you need to initialize the client with your <a href="Tidal.html"><code>Tidal</code></a> API credentials.</p>
110
+
111
+ <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;tidal&#39;</span>
112
+
113
+ <span class="ruby-identifier">client_id</span> = <span class="ruby-string">&#39;your_client_id&#39;</span>
114
+ <span class="ruby-identifier">client_secret</span> = <span class="ruby-string">&#39;your_client_secret&#39;</span>
115
+ <span class="ruby-identifier">client</span> = <span class="ruby-constant">Tidal</span><span class="ruby-operator">::</span><span class="ruby-constant">ClientV1</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">client_id</span>, <span class="ruby-identifier">client_secret</span>)
116
+ </pre>
117
+
118
+ <h3 id="label-Fetch+Albums+by+Barcode+ID">Fetch Albums by Barcode ID<span><a href="#label-Fetch+Albums+by+Barcode+ID">&para;</a> <a href="#top">&uarr;</a></span></h3>
119
+
120
+ <pre class="ruby"><span class="ruby-identifier">barcode_id</span> = <span class="ruby-string">&#39;123456789&#39;</span>
121
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
122
+ <span class="ruby-identifier">albums</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_albums_by_barcode_id</span>(<span class="ruby-identifier">barcode_id</span>, <span class="ruby-identifier">country_code</span>)
123
+ </pre>
124
+
125
+ <h3 id="label-Fetch+Multiple+Albums+by+IDs">Fetch Multiple Albums by IDs<span><a href="#label-Fetch+Multiple+Albums+by+IDs">&para;</a> <a href="#top">&uarr;</a></span></h3>
126
+
127
+ <pre class="ruby"><span class="ruby-identifier">album_ids</span> = [<span class="ruby-string">&#39;123&#39;</span>, <span class="ruby-string">&#39;456&#39;</span>, <span class="ruby-string">&#39;789&#39;</span>]
128
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
129
+ <span class="ruby-identifier">albums</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_multiple_albums</span>(<span class="ruby-identifier">album_ids</span>, <span class="ruby-identifier">country_code</span>)
130
+ </pre>
131
+
132
+ <h3 id="label-Fetch+Album+Items">Fetch Album Items<span><a href="#label-Fetch+Album+Items">&para;</a> <a href="#top">&uarr;</a></span></h3>
133
+
134
+ <pre class="ruby"><span class="ruby-identifier">album_id</span> = <span class="ruby-string">&#39;123&#39;</span>
135
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
136
+ <span class="ruby-identifier">items</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_album_items</span>(<span class="ruby-identifier">album_id</span>, <span class="ruby-identifier">country_code</span>)
137
+ </pre>
138
+
139
+ <h3 id="label-Fetch+Similar+Albums">Fetch Similar Albums<span><a href="#label-Fetch+Similar+Albums">&para;</a> <a href="#top">&uarr;</a></span></h3>
140
+
141
+ <pre class="ruby"><span class="ruby-identifier">album_id</span> = <span class="ruby-string">&#39;123&#39;</span>
142
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
143
+ <span class="ruby-identifier">similar_albums</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_similar_albums</span>(<span class="ruby-identifier">album_id</span>, <span class="ruby-identifier">country_code</span>)
144
+ </pre>
145
+
146
+ <h3 id="label-Fetch+Single+Album">Fetch Single Album<span><a href="#label-Fetch+Single+Album">&para;</a> <a href="#top">&uarr;</a></span></h3>
147
+
148
+ <pre class="ruby"><span class="ruby-identifier">album_id</span> = <span class="ruby-string">&#39;123&#39;</span>
149
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
150
+ <span class="ruby-identifier">album</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_single_album</span>(<span class="ruby-identifier">album_id</span>, <span class="ruby-identifier">country_code</span>)
151
+ </pre>
152
+
153
+ <h3 id="label-Fetch+Albums+by+Artist">Fetch Albums by Artist<span><a href="#label-Fetch+Albums+by+Artist">&para;</a> <a href="#top">&uarr;</a></span></h3>
154
+
155
+ <pre class="ruby"><span class="ruby-identifier">artist_id</span> = <span class="ruby-string">&#39;1234&#39;</span>
156
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
157
+ <span class="ruby-identifier">albums</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_albums_by_artist</span>(<span class="ruby-identifier">artist_id</span>, <span class="ruby-identifier">country_code</span>)
158
+ </pre>
159
+
160
+ <h3 id="label-Fetch+Multiple+Artists+by+IDs">Fetch Multiple Artists by IDs<span><a href="#label-Fetch+Multiple+Artists+by+IDs">&para;</a> <a href="#top">&uarr;</a></span></h3>
161
+
162
+ <pre class="ruby"><span class="ruby-identifier">artist_ids</span> = [<span class="ruby-string">&#39;123&#39;</span>, <span class="ruby-string">&#39;456&#39;</span>, <span class="ruby-string">&#39;789&#39;</span>]
163
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
164
+ <span class="ruby-identifier">artists</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_multiple_artists</span>(<span class="ruby-identifier">artist_ids</span>, <span class="ruby-identifier">country_code</span>)
165
+ </pre>
166
+
167
+ <h3 id="label-Fetch+Similar+Artists">Fetch Similar Artists<span><a href="#label-Fetch+Similar+Artists">&para;</a> <a href="#top">&uarr;</a></span></h3>
168
+
169
+ <pre class="ruby"><span class="ruby-identifier">artist_id</span> = <span class="ruby-string">&#39;1234&#39;</span>
170
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
171
+ <span class="ruby-identifier">similar_artists</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_similar_artists</span>(<span class="ruby-identifier">artist_id</span>, <span class="ruby-identifier">country_code</span>)
172
+ </pre>
173
+
174
+ <h3 id="label-Fetch+Single+Artist">Fetch Single Artist<span><a href="#label-Fetch+Single+Artist">&para;</a> <a href="#top">&uarr;</a></span></h3>
175
+
176
+ <pre class="ruby"><span class="ruby-identifier">artist_id</span> = <span class="ruby-string">&#39;1234&#39;</span>
177
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
178
+ <span class="ruby-identifier">artist</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_single_artist</span>(<span class="ruby-identifier">artist_id</span>, <span class="ruby-identifier">country_code</span>)
179
+ </pre>
180
+
181
+ <h3 id="label-Fetch+Tracks+by+Artist">Fetch Tracks by Artist<span><a href="#label-Fetch+Tracks+by+Artist">&para;</a> <a href="#top">&uarr;</a></span></h3>
182
+
183
+ <pre class="ruby"><span class="ruby-identifier">artist_id</span> = <span class="ruby-string">&#39;1234&#39;</span>
184
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
185
+ <span class="ruby-identifier">tracks</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_tracks_by_artist</span>(<span class="ruby-identifier">artist_id</span>, <span class="ruby-identifier">country_code</span>)
186
+ </pre>
187
+
188
+ <h3 id="label-Fetch+Multiple+Tracks+by+IDs">Fetch Multiple Tracks by IDs<span><a href="#label-Fetch+Multiple+Tracks+by+IDs">&para;</a> <a href="#top">&uarr;</a></span></h3>
189
+
190
+ <pre class="ruby"><span class="ruby-identifier">track_ids</span> = [<span class="ruby-string">&#39;123&#39;</span>, <span class="ruby-string">&#39;456&#39;</span>, <span class="ruby-string">&#39;789&#39;</span>]
191
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
192
+ <span class="ruby-identifier">tracks</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_multiple_tracks</span>(<span class="ruby-identifier">track_ids</span>, <span class="ruby-identifier">country_code</span>)
193
+ </pre>
194
+
195
+ <h3 id="label-Fetch+Tracks+by+ISRC">Fetch Tracks by ISRC<span><a href="#label-Fetch+Tracks+by+ISRC">&para;</a> <a href="#top">&uarr;</a></span></h3>
196
+
197
+ <pre class="ruby"><span class="ruby-identifier">isrc</span> = <span class="ruby-string">&#39;US1234567890&#39;</span>
198
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
199
+ <span class="ruby-identifier">tracks</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_tracks_by_isrc</span>(<span class="ruby-identifier">isrc</span>, <span class="ruby-identifier">country_code</span>)
200
+ </pre>
201
+
202
+ <h3 id="label-Fetch+Single+Track">Fetch Single Track<span><a href="#label-Fetch+Single+Track">&para;</a> <a href="#top">&uarr;</a></span></h3>
203
+
204
+ <pre class="ruby"><span class="ruby-identifier">track_id</span> = <span class="ruby-string">&#39;1234&#39;</span>
205
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
206
+ <span class="ruby-identifier">track</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_single_track</span>(<span class="ruby-identifier">track_id</span>, <span class="ruby-identifier">country_code</span>)
207
+ </pre>
208
+
209
+ <h3 id="label-Fetch+Similar+Tracks">Fetch Similar Tracks<span><a href="#label-Fetch+Similar+Tracks">&para;</a> <a href="#top">&uarr;</a></span></h3>
210
+
211
+ <pre class="ruby"><span class="ruby-identifier">track_id</span> = <span class="ruby-string">&#39;1234&#39;</span>
212
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
213
+ <span class="ruby-identifier">similar_tracks</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_similar_tracks</span>(<span class="ruby-identifier">track_id</span>, <span class="ruby-identifier">country_code</span>)
214
+ </pre>
215
+
216
+ <h3 id="label-Fetch+Multiple+Videos+by+IDs">Fetch Multiple Videos by IDs<span><a href="#label-Fetch+Multiple+Videos+by+IDs">&para;</a> <a href="#top">&uarr;</a></span></h3>
217
+
218
+ <pre class="ruby"><span class="ruby-identifier">video_ids</span> = [<span class="ruby-string">&#39;123&#39;</span>, <span class="ruby-string">&#39;456&#39;</span>, <span class="ruby-string">&#39;789&#39;</span>]
219
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
220
+ <span class="ruby-identifier">videos</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_multiple_videos</span>(<span class="ruby-identifier">video_ids</span>, <span class="ruby-identifier">country_code</span>)
221
+ </pre>
222
+
223
+ <h3 id="label-Fetch+Single+Video">Fetch Single Video<span><a href="#label-Fetch+Single+Video">&para;</a> <a href="#top">&uarr;</a></span></h3>
224
+
225
+ <pre class="ruby"><span class="ruby-identifier">video_id</span> = <span class="ruby-string">&#39;1234&#39;</span>
226
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
227
+ <span class="ruby-identifier">video</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_single_video</span>(<span class="ruby-identifier">video_id</span>, <span class="ruby-identifier">country_code</span>)
228
+ </pre>
229
+
230
+ <h3 id="label-Search">Search<span><a href="#label-Search">&para;</a> <a href="#top">&uarr;</a></span></h3>
231
+
232
+ <pre class="ruby"><span class="ruby-identifier">query</span> = <span class="ruby-string">&#39;Shape of You&#39;</span>
233
+ <span class="ruby-identifier">country_code</span> = <span class="ruby-string">&#39;US&#39;</span>
234
+ <span class="ruby-identifier">search_results</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_search</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">country_code</span>)
235
+ </pre>
236
+
237
+ <h2 id="label-Development">Development<span><a href="#label-Development">&para;</a> <a href="#top">&uarr;</a></span></h2>
238
+
239
+ <p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake spec</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
240
+
241
+ <p>To install this gem onto your local machine, run <code>bundle exec rake install</code>. To release a new version, update the version number in <code>version.rb</code>, and then run <code>bundle exec rake release</code>, which will create a git tag for the version, push git commits and the created tag, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p>
242
+
243
+ <h2 id="label-Contributing">Contributing<span><a href="#label-Contributing">&para;</a> <a href="#top">&uarr;</a></span></h2>
244
+
245
+ <p>Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/[USERNAME]/tidal">github.com/[USERNAME]/tidal</a>.</p>
246
+
247
+ <h2 id="label-License">License<span><a href="#label-License">&para;</a> <a href="#top">&uarr;</a></span></h2>
248
+
249
+ <p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
250
+
251
+ </main>
252
+
253
+
254
+ <footer id="validator-badges" role="contentinfo">
255
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
256
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.7.0.
257
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
258
+ </footer>
259
+
@@ -0,0 +1,97 @@
1
+ /**
2
+ *
3
+ * Darkfish Page Functions
4
+ * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
5
+ *
6
+ * Author: Michael Granger <mgranger@laika.com>
7
+ *
8
+ */
9
+
10
+ /* Provide console simulation for firebug-less environments */
11
+ /*
12
+ if (!("console" in window) || !("firebug" in console)) {
13
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
14
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
15
+
16
+ window.console = {};
17
+ for (var i = 0; i < names.length; ++i)
18
+ window.console[names[i]] = function() {};
19
+ };
20
+ */
21
+
22
+
23
+ function showSource( e ) {
24
+ var target = e.target;
25
+ while (!target.classList.contains('method-detail')) {
26
+ target = target.parentNode;
27
+ }
28
+ if (typeof target !== "undefined" && target !== null) {
29
+ target = target.querySelector('.method-source-code');
30
+ }
31
+ if (typeof target !== "undefined" && target !== null) {
32
+ target.classList.toggle('active-menu')
33
+ }
34
+ };
35
+
36
+ function hookSourceViews() {
37
+ document.querySelectorAll('.method-heading').forEach(function (codeObject) {
38
+ codeObject.addEventListener('click', showSource);
39
+ });
40
+ };
41
+
42
+ function hookSearch() {
43
+ var input = document.querySelector('#search-field');
44
+ var result = document.querySelector('#search-results');
45
+ result.classList.remove("initially-hidden");
46
+
47
+ var search_section = document.querySelector('#search-section');
48
+ search_section.classList.remove("initially-hidden");
49
+
50
+ var search = new Search(search_data, input, result);
51
+
52
+ search.renderItem = function(result) {
53
+ var li = document.createElement('li');
54
+ var html = '';
55
+
56
+ // TODO add relative path to <script> per-page
57
+ html += '<p class="search-match"><a href="' + index_rel_prefix + this.escapeHTML(result.path) + '">' + this.hlt(result.title);
58
+ if (result.params)
59
+ html += '<span class="params">' + result.params + '</span>';
60
+ html += '</a>';
61
+
62
+
63
+ if (result.namespace)
64
+ html += '<p class="search-namespace">' + this.hlt(result.namespace);
65
+
66
+ if (result.snippet)
67
+ html += '<div class="search-snippet">' + result.snippet + '</div>';
68
+
69
+ li.innerHTML = html;
70
+
71
+ return li;
72
+ }
73
+
74
+ search.select = function(result) {
75
+ window.location.href = result.firstChild.firstChild.href;
76
+ }
77
+
78
+ search.scrollIntoView = search.scrollInWindow;
79
+ };
80
+
81
+ function hookFocus() {
82
+ document.addEventListener("keydown", (event) => {
83
+ if (document.activeElement.tagName === 'INPUT') {
84
+ return;
85
+ }
86
+ if (event.key === "/") {
87
+ event.preventDefault();
88
+ document.querySelector('#search-field').focus();
89
+ }
90
+ });
91
+ }
92
+
93
+ document.addEventListener('DOMContentLoaded', function() {
94
+ hookSourceViews();
95
+ hookSearch();
96
+ hookFocus();
97
+ });
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Navigation allows movement using the arrow keys through the search results.
3
+ *
4
+ * When using this library you will need to set scrollIntoView to the
5
+ * appropriate function for your layout. Use scrollInWindow if the container
6
+ * is not scrollable and scrollInElement if the container is a separate
7
+ * scrolling region.
8
+ */
9
+ Navigation = new function() {
10
+ this.initNavigation = function() {
11
+ var _this = this;
12
+
13
+ document.addEventListener('keydown', function(e) {
14
+ _this.onkeydown(e);
15
+ });
16
+
17
+ this.navigationActive = true;
18
+ }
19
+
20
+ this.setNavigationActive = function(state) {
21
+ this.navigationActive = state;
22
+ }
23
+
24
+ this.onkeydown = function(e) {
25
+ if (!this.navigationActive) return;
26
+ switch(e.key) {
27
+ case 'ArrowLeft':
28
+ if (this.moveLeft()) e.preventDefault();
29
+ break;
30
+ case 'ArrowUp':
31
+ if (e.key == 'ArrowUp' || e.ctrlKey) {
32
+ if (this.moveUp()) e.preventDefault();
33
+ }
34
+ break;
35
+ case 'ArrowRight':
36
+ if (this.moveRight()) e.preventDefault();
37
+ break;
38
+ case 'ArrowDown':
39
+ if (e.key == 'ArrowDown' || e.ctrlKey) {
40
+ if (this.moveDown()) e.preventDefault();
41
+ }
42
+ break;
43
+ case 'Enter':
44
+ if (this.current) e.preventDefault();
45
+ this.select(this.current);
46
+ break;
47
+ }
48
+ if (e.ctrlKey && e.shiftKey) this.select(this.current);
49
+ }
50
+
51
+ this.moveRight = function() {
52
+ }
53
+
54
+ this.moveLeft = function() {
55
+ }
56
+
57
+ this.move = function(isDown) {
58
+ }
59
+
60
+ this.moveUp = function() {
61
+ return this.move(false);
62
+ }
63
+
64
+ this.moveDown = function() {
65
+ return this.move(true);
66
+ }
67
+
68
+ /*
69
+ * Scrolls to the given element in the scrollable element view.
70
+ */
71
+ this.scrollInElement = function(element, view) {
72
+ var offset, viewHeight, viewScroll, height;
73
+ offset = element.offsetTop;
74
+ height = element.offsetHeight;
75
+ viewHeight = view.offsetHeight;
76
+ viewScroll = view.scrollTop;
77
+
78
+ if (offset - viewScroll + height > viewHeight) {
79
+ view.scrollTop = offset - viewHeight + height;
80
+ }
81
+ if (offset < viewScroll) {
82
+ view.scrollTop = offset;
83
+ }
84
+ }
85
+
86
+ /*
87
+ * Scrolls to the given element in the window. The second argument is
88
+ * ignored
89
+ */
90
+ this.scrollInWindow = function(element, ignored) {
91
+ var offset, viewHeight, viewScroll, height;
92
+ offset = element.offsetTop;
93
+ height = element.offsetHeight;
94
+ viewHeight = window.innerHeight;
95
+ viewScroll = window.scrollY;
96
+
97
+ if (offset - viewScroll + height > viewHeight) {
98
+ window.scrollTo(window.scrollX, offset - viewHeight + height);
99
+ }
100
+ if (offset < viewScroll) {
101
+ window.scrollTo(window.scrollX, offset);
102
+ }
103
+ }
104
+ }
105
+
Binary file
data/docs/js/search.js ADDED
@@ -0,0 +1,110 @@
1
+ Search = function(data, input, result) {
2
+ this.data = data;
3
+ this.input = input;
4
+ this.result = result;
5
+
6
+ this.current = null;
7
+ this.view = this.result.parentNode;
8
+ this.searcher = new Searcher(data.index);
9
+ this.init();
10
+ }
11
+
12
+ Search.prototype = Object.assign({}, Navigation, new function() {
13
+ var suid = 1;
14
+
15
+ this.init = function() {
16
+ var _this = this;
17
+ var observer = function(e) {
18
+ switch(e.key) {
19
+ case 'ArrowUp':
20
+ case 'ArrowDown':
21
+ return;
22
+ }
23
+ _this.search(_this.input.value);
24
+ };
25
+ this.input.addEventListener('keyup', observer);
26
+ this.input.addEventListener('click', observer); // mac's clear field
27
+
28
+ this.searcher.ready(function(results, isLast) {
29
+ _this.addResults(results, isLast);
30
+ })
31
+
32
+ this.initNavigation();
33
+ this.setNavigationActive(false);
34
+ }
35
+
36
+ this.search = function(value, selectFirstMatch) {
37
+ value = value.trim().toLowerCase();
38
+ if (value) {
39
+ this.setNavigationActive(true);
40
+ } else {
41
+ this.setNavigationActive(false);
42
+ }
43
+
44
+ if (value == '') {
45
+ this.lastQuery = value;
46
+ this.result.innerHTML = '';
47
+ this.result.setAttribute('aria-expanded', 'false');
48
+ this.setNavigationActive(false);
49
+ } else if (value != this.lastQuery) {
50
+ this.lastQuery = value;
51
+ this.result.setAttribute('aria-busy', 'true');
52
+ this.result.setAttribute('aria-expanded', 'true');
53
+ this.firstRun = true;
54
+ this.searcher.find(value);
55
+ }
56
+ }
57
+
58
+ this.addResults = function(results, isLast) {
59
+ var target = this.result;
60
+ if (this.firstRun && (results.length > 0 || isLast)) {
61
+ this.current = null;
62
+ this.result.innerHTML = '';
63
+ }
64
+
65
+ for (var i=0, l = results.length; i < l; i++) {
66
+ var item = this.renderItem.call(this, results[i]);
67
+ item.setAttribute('id', 'search-result-' + target.childElementCount);
68
+ target.appendChild(item);
69
+ };
70
+
71
+ if (this.firstRun && results.length > 0) {
72
+ this.firstRun = false;
73
+ this.current = target.firstChild;
74
+ this.current.classList.add('search-selected');
75
+ }
76
+ //TODO: ECMAScript
77
+ //if (jQuery.browser.msie) this.$element[0].className += '';
78
+
79
+ if (isLast) this.result.setAttribute('aria-busy', 'false');
80
+ }
81
+
82
+ this.move = function(isDown) {
83
+ if (!this.current) return;
84
+ var next = isDown ? this.current.nextElementSibling : this.current.previousElementSibling;
85
+ if (next) {
86
+ this.current.classList.remove('search-selected');
87
+ next.classList.add('search-selected');
88
+ this.input.setAttribute('aria-activedescendant', next.getAttribute('id'));
89
+ this.scrollIntoView(next, this.view);
90
+ this.current = next;
91
+ this.input.value = next.firstChild.firstChild.text;
92
+ this.input.select();
93
+ }
94
+ return true;
95
+ }
96
+
97
+ this.hlt = function(html) {
98
+ return this.escapeHTML(html).
99
+ replace(/\u0001/g, '<em>').
100
+ replace(/\u0002/g, '</em>');
101
+ }
102
+
103
+ this.escapeHTML = function(html) {
104
+ return html.replace(/[&<>"`']/g, function(c) {
105
+ return '&#' + c.charCodeAt(0) + ';';
106
+ });
107
+ }
108
+
109
+ });
110
+
@@ -0,0 +1 @@
1
+ var search_data = {"index":{"searchIndex":["tidal","clientv1","error","get_album_items()","get_albums_by_artist()","get_albums_by_barcode_id()","get_multiple_albums()","get_multiple_artists()","get_multiple_tracks()","get_multiple_videos()","get_search()","get_similar_albums()","get_similar_artists()","get_similar_tracks()","get_single_album()","get_single_artist()","get_single_track()","get_single_video()","get_tracks_by_artist()","get_tracks_by_isrc()","new()","readme"],"longSearchIndex":["tidal","tidal::clientv1","tidal::error","tidal::clientv1#get_album_items()","tidal::clientv1#get_albums_by_artist()","tidal::clientv1#get_albums_by_barcode_id()","tidal::clientv1#get_multiple_albums()","tidal::clientv1#get_multiple_artists()","tidal::clientv1#get_multiple_tracks()","tidal::clientv1#get_multiple_videos()","tidal::clientv1#get_search()","tidal::clientv1#get_similar_albums()","tidal::clientv1#get_similar_artists()","tidal::clientv1#get_similar_tracks()","tidal::clientv1#get_single_album()","tidal::clientv1#get_single_artist()","tidal::clientv1#get_single_track()","tidal::clientv1#get_single_video()","tidal::clientv1#get_tracks_by_artist()","tidal::clientv1#get_tracks_by_isrc()","tidal::clientv1::new()",""],"info":[["Tidal","","Tidal.html","",""],["Tidal::ClientV1","","Tidal/ClientV1.html","",""],["Tidal::Error","","Tidal/Error.html","",""],["get_album_items","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_album_items","(album_id, country_code, offset = nil, limit = nil)","<p>Get album items\n<p>@param album_id [String] The album ID @param country_code [String] The country code @param …\n"],["get_albums_by_artist","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_albums_by_artist","(artist_id, country_code, offset = nil, limit = nil)","<p>Get albums by artist\n<p>@param artist_id [String] The artist ID @param country_code [String] The country …\n"],["get_albums_by_barcode_id","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_albums_by_barcode_id","(barcode_id, country_code)","<p>Get albums by barcode ID\n<p>@param barcode_id [String] The barcode ID @param country_code [String] The country …\n"],["get_multiple_albums","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_multiple_albums","(ids, country_code)","<p>Get multiple albums\n<p>@param ids [Array] The array of album IDs @param country_code [String] The country …\n"],["get_multiple_artists","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_multiple_artists","(ids, country_code)","<p>Get multiple artists\n<p>@param ids [Array] The array of artist IDs @param country_code [String] The country …\n"],["get_multiple_tracks","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_multiple_tracks","(ids, country_code)","<p>Get multiple tracks\n<p>@param ids [Array] The array of track IDs @param country_code [String] The country …\n"],["get_multiple_videos","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_multiple_videos","(ids, country_code)","<p>Get multiple videos\n<p>@param ids [Array] The array of video IDs @param country_code [String] The country …\n"],["get_search","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_search","(query, country_code, type = nil, popularity = nil, offset = nil, limit = nil)","<p>Search for content\n<p>@param query [String] The search query @param country_code [String] The country code …\n"],["get_similar_albums","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_similar_albums","(album_id, country_code, offset = nil, limit = nil)","<p>Get similar albums\n<p>@param album_id [String] The album ID @param country_code [String] The country code …\n"],["get_similar_artists","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_similar_artists","(artist_id, country_code, offset = nil, limit = nil)","<p>Get similar artists\n<p>@param artist_id [String] The artist ID @param country_code [String] The country code …\n"],["get_similar_tracks","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_similar_tracks","(track_id, country_code, offset = nil, limit = nil)","<p>Get similar tracks\n<p>@param track_id [String] The track ID @param country_code [String] The country code …\n"],["get_single_album","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_single_album","(album_id, country_code)","<p>Get a single album\n<p>@param album_id [String] The album ID @param country_code [String] The country code …\n"],["get_single_artist","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_single_artist","(artist_id, country_code)","<p>Get a single artist\n<p>@param artist_id [String] The artist ID @param country_code [String] The country code …\n"],["get_single_track","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_single_track","(artist_id, country_code)","<p>Get a single track\n<p>@param artist_id [String] The artist ID @param country_code [String] The country code …\n"],["get_single_video","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_single_video","(video_id, country_code)","<p>Get a single video\n<p>@param video_id [String] The video ID @param country_code [String] The country code …\n"],["get_tracks_by_artist","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_tracks_by_artist","(artist_id, country_code, collapse_by = nil, offset = nil, limit = nil)","<p>Get tracks by artist\n<p>@param artist_id [String] The artist ID @param country_code [String] The country …\n"],["get_tracks_by_isrc","Tidal::ClientV1","Tidal/ClientV1.html#method-i-get_tracks_by_isrc","(isrc, country_code, offset = nil, limit = nil)","<p>Get tracks by ISRC\n<p>@param isrc [String] The ISRC code @param country_code [String] The country code @param …\n"],["new","Tidal::ClientV1","Tidal/ClientV1.html#method-c-new","(client_id, client_secret)","<p>Initialize the Tidal client\n<p>@param client_id [String] The client ID for the Tidal API @param client_secret …\n"],["README","","README_md.html","","<p>Tidal\n<p>A Ruby wrapper to interact with the Tidal API. This gem provides a Ruby wrapper around the Tidal …\n"]]}}
Binary file