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">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
7 Class: Lyricli::Sources::Rdio
9 — Documentation by YARD
0.8.1
13 <link rel=
"stylesheet" href=
"../../css/style.css" type=
"text/css" media=
"screen" charset=
"utf-8" />
15 <link rel=
"stylesheet" href=
"../../css/common.css" type=
"text/css" media=
"screen" charset=
"utf-8" />
17 <script type=
"text/javascript" charset=
"utf-8">
18 hasFrames = window.top.frames.main ? true : false;
20 framesUrl = "../../frames.html#!" + escape(window.location.href);
24 <script type=
"text/javascript" charset=
"utf-8" src=
"../../js/jquery.js"></script>
26 <script type=
"text/javascript" charset=
"utf-8" src=
"../../js/app.js"></script>
34 <a href=
"../../_index.html">Index (R)
</a> »
35 <span class='title'
><span class='object_link'
><a href=
"../../Lyricli.html" title=
"Lyricli (module)">Lyricli
</a></span></span> » <span class='title'
><span class='object_link'
><a href=
"../Sources.html" title=
"Lyricli::Sources (module)">Sources
</a></span></span>
37 <span class=
"title">Rdio
</span>
40 <div class=
"noframes"><span class=
"title">(
</span><a href=
"." target=
"_top">no frames
</a><span class=
"title">)
</span></div>
45 <a class=
"full_list_link" id=
"class_list_link"
46 href=
"../../class_list.html">
50 <a class=
"full_list_link" id=
"method_list_link"
51 href=
"../../method_list.html">
55 <a class=
"full_list_link" id=
"file_list_link"
56 href=
"../../file_list.html">
61 <div class=
"clear"></div>
64 <iframe id=
"search_frame"></iframe>
66 <div id=
"content"><h1>Class: Lyricli::Sources::Rdio
74 <dt class=
"r1">Inherits:
</dt>
76 <span class=
"inheritName">Object
</span>
81 <li class=
"next">Lyricli::Sources::Rdio
</li>
84 <a href=
"#" class=
"inheritanceTree">show all
</a>
96 <dt class=
"r2 last">Defined in:
</dt>
97 <dd class=
"r2 last">lib/lyricli/sources/rdio.rb
</dd>
100 <div class=
"clear"></div>
106 <h2>Class Attribute Summary
<small>(
<a href=
"#" class=
"summary_toggle">collapse
</a>)
</small></h2>
110 <span class=
"summary_signature">
112 <a href=
"#name-class_method" title=
"name (class method)">+ (Object)
<strong>name
</strong> </a>
129 <span class=
"summary_desc"><div class='inline'
><p>
130 Returns the value of attribute name.
145 <small>(
<a href=
"#" class=
"summary_toggle">collapse
</a>)
</small>
151 <span class=
"summary_signature">
153 <a href=
"#create_auth_token-class_method" title=
"create_auth_token (class method)">+ (Object)
<strong>create_auth_token
</strong> </a>
167 <span class=
"summary_desc"><div class='inline'
><p>
168 Signs in to rdio with our credentials and requests access for a new auth
177 <span class=
"summary_signature">
179 <a href=
"#enable-class_method" title=
"enable (class method)">+ (Object)
<strong>enable
</strong> </a>
193 <span class=
"summary_desc"><div class='inline'
><p>
194 The enable method should run all of the tasks needed to validate the
203 <span class=
"summary_signature">
205 <a href=
"#reset-class_method" title=
"reset (class method)">+ (Object)
<strong>reset
</strong> </a>
219 <span class=
"summary_desc"><div class='inline'
><p>
220 The reset method resets any configurations it may have.
230 Instance Method Summary
231 <small>(
<a href=
"#" class=
"summary_toggle">collapse
</a>)
</small>
237 <span class=
"summary_signature">
239 <a href=
"#current_track-instance_method" title=
"#current_track (instance method)">- (Hash)
<strong>current_track
</strong> </a>
253 <span class=
"summary_desc"><div class='inline'
><p>
254 The current_track method should return the name of the current artist and
263 <span class=
"summary_signature">
265 <a href=
"#initialize-instance_method" title=
"#initialize (instance method)">- (Rdio)
<strong>initialize
</strong> </a>
272 <span class=
"note title constructor">constructor
</span>
281 <span class=
"summary_desc"><div class='inline'
><p>
282 Instantiates everything it needs to run.
292 <div id=
"constructor_details" class=
"method_details_list">
293 <h2>Constructor Details
</h2>
295 <div class=
"method_details first">
296 <h3 class=
"signature first" id=
"initialize-instance_method">
298 - (
<tt><span class='object_link'
><a href=
"" title=
"Lyricli::Sources::Rdio (class)">Rdio
</a></span></tt>)
<strong>initialize
</strong>
304 </h3><div class=
"docstring">
305 <div class=
"discussion">
307 Instantiates everything it needs to run.
316 </div><table class=
"source_code">
329 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/sources/rdio.rb', line
23</span>
331 <span class='kw'
>def
</span> <span class='id identifier rubyid_initialize'
>initialize
</span>
332 <span class='ivar'
>@name
</span> <span class='op'
>=
</span> <span class='tstring'
><span class='tstring_beg'
>'
</span><span class='tstring_content'
>rdio
</span><span class='tstring_end'
>'
</span></span>
333 <span class='ivar'
>@config
</span> <span class='op'
>=
</span> <span class='const'
>Lyricli
</span><span class='op'
>::
</span><span class='const'
>Configuration
</span><span class='period'
>.
</span><span class='id identifier rubyid_instance'
>instance
</span>
334 <span class='ivar'
>@rdio
</span> <span class='op'
>=
</span> <span class='const'
>Rdio
</span><span class='op'
>::
</span><span class='const'
>SimpleRdio
</span><span class='period'
>.
</span><span class='id identifier rubyid_new'
>new
</span><span class='lparen'
>(
</span><span class='lbracket'
>[
</span><span class='ivar'
>@config
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>rdio_key
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span><span class='comma'
>,
</span> <span class='ivar'
>@config
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>rdio_secret
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span><span class='rbracket'
>]
</span><span class='comma'
>,
</span> <span class='ivar'
>@config
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>rdio_auth_token
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span><span class='rparen'
>)
</span>
335 <span class='kw'
>end
</span></pre>
343 <div id=
"class_attr_details" class=
"attr_details">
344 <h2>Class Attribute Details
</h2>
347 <span id=
"name=-class_method"></span>
348 <span id=
"name-class_method"></span>
349 <div class=
"method_details first">
350 <h3 class=
"signature first" id=
"name-class_method">
352 + (
<tt>Object
</tt>)
<strong>name
</strong>
358 </h3><div class=
"docstring">
359 <div class=
"discussion">
361 Returns the value of attribute name
370 </div><table class=
"source_code">
381 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/sources/rdio.rb', line
6</span>
383 <span class='kw'
>def
</span> <span class='id identifier rubyid_name'
>name
</span>
384 <span class='ivar'
>@name
</span>
385 <span class='kw'
>end
</span></pre>
394 <div id=
"class_method_details" class=
"method_details_list">
395 <h2>Class Method Details
</h2>
398 <div class=
"method_details first">
399 <h3 class=
"signature first" id=
"create_auth_token-class_method">
401 + (
<tt>Object
</tt>)
<strong>create_auth_token
</strong>
407 </h3><div class=
"docstring">
408 <div class=
"discussion">
410 Signs in to rdio with our credentials and requests access for a new auth
420 </div><table class=
"source_code">
445 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/sources/rdio.rb', line
46</span>
447 <span class='kw'
>def
</span> <span class='kw'
>self
</span><span class='period'
>.
</span><span class='id identifier rubyid_create_auth_token'
>create_auth_token
</span>
448 <span class='ivar'
>@rdio
</span> <span class='op'
>=
</span> <span class='const'
>Rdio
</span><span class='op'
>::
</span><span class='const'
>SimpleRdio
</span><span class='period'
>.
</span><span class='id identifier rubyid_new'
>new
</span><span class='lparen'
>(
</span><span class='lbracket'
>[
</span><span class='ivar'
>@config
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>rdio_key
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span><span class='comma'
>,
</span> <span class='ivar'
>@config
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>rdio_secret
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span><span class='rbracket'
>]
</span><span class='comma'
>,
</span> <span class='ivar'
>@config
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>rdio_auth_token
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span><span class='rparen'
>)
</span>
450 <span class='comment'
># Request Authorization
451 </span> <span class='id identifier rubyid_puts'
>puts
</span> <span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>Follow this URL to authorize lyricli:
</span><span class='tstring_end'
>"</span></span>
452 <span class='id identifier rubyid_auth_url'
>auth_url
</span> <span class='op'
>=
</span> <span class='id identifier rubyid_rdio'
>rdio
</span><span class='period'
>.
</span><span class='id identifier rubyid_begin_authentication'
>begin_authentication
</span><span class='lparen'
>(
</span><span class='tstring'
><span class='tstring_beg'
>'
</span><span class='tstring_content'
>oob
</span><span class='tstring_end'
>'
</span></span><span class='rparen'
>)
</span>
453 <span class='id identifier rubyid_puts'
>puts
</span> <span class='id identifier rubyid_auth_url'
>auth_url
</span>
454 <span class='const'
>Launchy
</span><span class='period'
>.
</span><span class='id identifier rubyid_open'
>open
</span><span class='lparen'
>(
</span><span class='id identifier rubyid_auth_url'
>auth_url
</span><span class='rparen'
>)
</span>
456 <span class='comment'
># Request Code, Obtain Token
457 </span> <span class='id identifier rubyid_print'
>print
</span> <span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>Please type the authorization code:
</span><span class='tstring_end'
>"</span></span>
458 <span class='id identifier rubyid_auth_code'
>auth_code
</span> <span class='op'
>=
</span> <span class='id identifier rubyid_gets'
>gets
</span><span class='period'
>.
</span><span class='id identifier rubyid_chomp'
>chomp
</span>
459 <span class='id identifier rubyid_token'
>token
</span> <span class='op'
>=
</span> <span class='id identifier rubyid_rdio'
>rdio
</span><span class='period'
>.
</span><span class='id identifier rubyid_complete_authentication'
>complete_authentication
</span><span class='lparen'
>(
</span><span class='id identifier rubyid_auth_code'
>auth_code
</span><span class='rparen'
>)
</span>
461 <span class='ivar'
>@config
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>rdio_auth_token
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span> <span class='op'
>=
</span> <span class='id identifier rubyid_token'
>token
</span>
462 <span class='id identifier rubyid_token'
>token
</span>
463 <span class='kw'
>end
</span></pre>
469 <div class=
"method_details ">
470 <h3 class=
"signature " id=
"enable-class_method">
472 + (
<tt>Object
</tt>)
<strong>enable
</strong>
478 </h3><div class=
"docstring">
479 <div class=
"discussion">
481 The enable method should run all of the tasks needed to validate the
482 source. In the case of Rdio it has to authenticate with OAuth.
491 </div><table class=
"source_code">
507 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/sources/rdio.rb', line
13</span>
509 <span class='kw'
>def
</span> <span class='kw'
>self
</span><span class='period'
>.
</span><span class='id identifier rubyid_enable'
>enable
</span>
510 <span class='comment'
># Validation Code
511 </span> <span class='ivar'
>@config
</span> <span class='op'
>=
</span> <span class='const'
>Lyricli
</span><span class='op'
>::
</span><span class='const'
>Configuration
</span><span class='period'
>.
</span><span class='id identifier rubyid_instance'
>instance
</span>
512 <span class='kw'
>unless
</span> <span class='ivar'
>@config
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>rdio_auth_token
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span> <span class='op'
>&&</span> <span class='op'
>!
</span><span class='ivar'
>@config
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>rdio_auth_token
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span><span class='period'
>.
</span><span class='id identifier rubyid_empty?'
>empty?
</span>
513 <span class='id identifier rubyid_create_auth_token'
>create_auth_token
</span>
514 <span class='kw'
>end
</span>
516 <span class='kw'
>end
</span></pre>
522 <div class=
"method_details ">
523 <h3 class=
"signature " id=
"reset-class_method">
525 + (
<tt>Object
</tt>)
<strong>reset
</strong>
531 </h3><div class=
"docstring">
532 <div class=
"discussion">
534 The reset method resets any configurations it may have
543 </div><table class=
"source_code">
554 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/sources/rdio.rb', line
40</span>
556 <span class='kw'
>def
</span> <span class='kw'
>self
</span><span class='period'
>.
</span><span class='id identifier rubyid_reset'
>reset
</span>
557 <span class='comment'
># Reset Code
558 </span><span class='kw'
>end
</span></pre>
566 <div id=
"instance_method_details" class=
"method_details_list">
567 <h2>Instance Method Details
</h2>
570 <div class=
"method_details first">
571 <h3 class=
"signature first" id=
"current_track-instance_method">
573 - (
<tt>Hash
</tt>)
<strong>current_track
</strong>
579 </h3><div class=
"docstring">
580 <div class=
"discussion">
582 The current_track method should return the name of the current artist and
591 <p class=
"tag_title">Returns:
</p>
597 <span class='type'
>(
<tt>Hash
</tt>)
</span>
602 <div class='inline'
><p>
603 A hash containing the current `:song` and `:artist`.
611 </div><table class=
"source_code">
625 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/sources/rdio.rb', line
32</span>
627 <span class='kw'
>def
</span> <span class='id identifier rubyid_current_track'
>current_track
</span>
628 <span class='id identifier rubyid_response'
>response
</span> <span class='op'
>=
</span> <span class='ivar'
>@rdio
</span><span class='period'
>.
</span><span class='id identifier rubyid_call'
>call
</span><span class='lparen'
>(
</span><span class='tstring'
><span class='tstring_beg'
>'
</span><span class='tstring_content'
>currentUser
</span><span class='tstring_end'
>'
</span></span><span class='comma'
>,
</span> <span class='lbrace'
>{
</span><span class='tstring'
><span class='tstring_beg'
>'
</span><span class='tstring_content'
>extras
</span><span class='tstring_end'
>'
</span></span> <span class='op'
>=
></span> <span class='tstring'
><span class='tstring_beg'
>'
</span><span class='tstring_content'
>lastSongPlayed
</span><span class='tstring_end'
>'
</span></span><span class='rbrace'
>}
</span><span class='rparen'
>)
</span>
629 <span class='id identifier rubyid_artist'
>artist
</span> <span class='op'
>=
</span> <span class='id identifier rubyid_response'
>response
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>result
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>lastSongPlayed
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>artist
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span>
630 <span class='id identifier rubyid_song'
>song
</span> <span class='op'
>=
</span> <span class='id identifier rubyid_response'
>response
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>result
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>lastSongPlayed
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span><span class='lbracket'
>[
</span><span class='tstring'
><span class='tstring_beg'
>"</span><span class='tstring_content'
>name
</span><span class='tstring_end'
>"</span></span><span class='rbracket'
>]
</span>
631 <span class='lbrace'
>{
</span><span class='label'
>artist:
</span> <span class='id identifier rubyid_artist'
>artist
</span><span class='comma'
>,
</span> <span class='label'
>song:
</span> <span class='id identifier rubyid_song'
>song
</span><span class='rbrace'
>}
</span>
632 <span class='kw'
>end
</span></pre>
643 Generated on Fri Oct
5 22:
31:
14 2012 by
644 <a href=
"http://yardoc.org" title=
"Yay! A Ruby Documentation Tool" target=
"_parent">yard
</a>