sofa 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/.document +5 -0
  2. data/.yardopts +6 -0
  3. data/Rakefile +76 -0
  4. data/doc/Sofa.html +85 -0
  5. data/doc/Sofa/Mapping.html +168 -0
  6. data/doc/Sofa/Mapping/ClassMethods.html +314 -0
  7. data/doc/Sofa/Mapping/InstanceMethods.html +358 -0
  8. data/doc/Sofa/TVRage.html +85 -0
  9. data/doc/Sofa/TVRage/Episode.html +358 -0
  10. data/doc/Sofa/TVRage/Schedule.html +207 -0
  11. data/doc/Sofa/TVRage/Season.html +236 -0
  12. data/doc/Sofa/TVRage/Show.html +904 -0
  13. data/doc/Sofa/TVRage/Show/ShowNotFound.html +92 -0
  14. data/doc/Sofa/Version.html +100 -0
  15. data/doc/_index.html +206 -0
  16. data/doc/class_list.html +137 -0
  17. data/doc/css/common.css +1 -0
  18. data/doc/css/full_list.css +23 -0
  19. data/doc/css/style.css +261 -0
  20. data/doc/file.README.html +120 -0
  21. data/doc/file_list.html +29 -0
  22. data/doc/index.html +120 -0
  23. data/doc/js/app.js +91 -0
  24. data/doc/js/full_list.js +39 -0
  25. data/doc/js/jquery.js +19 -0
  26. data/doc/method_list.html +192 -0
  27. data/doc/top-level-namespace.html +80 -0
  28. data/lib/sofa.rb +7 -0
  29. data/lib/sofa/mapping.rb +108 -0
  30. data/lib/sofa/tvrage.rb +10 -0
  31. data/lib/sofa/tvrage/episode.rb +56 -0
  32. data/lib/sofa/tvrage/schedule.rb +25 -0
  33. data/lib/sofa/tvrage/season.rb +36 -0
  34. data/lib/sofa/tvrage/show.rb +132 -0
  35. data/lib/sofa/version.rb +8 -0
  36. data/sofa.gemspec +113 -0
  37. data/spec/fixtures/tvrage/cases/castle.xml +228 -0
  38. data/spec/fixtures/tvrage/cases/community.xml +109 -0
  39. data/spec/fixtures/tvrage/cases/live_with_regis_and_kelly.xml +56237 -0
  40. data/spec/fixtures/tvrage/episode_info.xml +30 -0
  41. data/spec/fixtures/tvrage/episode_list.xml +1183 -0
  42. data/spec/fixtures/tvrage/episode_list_one_season.xml +17 -0
  43. data/spec/fixtures/tvrage/episode_list_two_episodes.xml +25 -0
  44. data/spec/fixtures/tvrage/full_schedule.xml +4731 -0
  45. data/spec/fixtures/tvrage/full_show_info.xml +1291 -0
  46. data/spec/fixtures/tvrage/quickinfo.html +17 -0
  47. data/spec/fixtures/tvrage/quickinfo_missing.html +1 -0
  48. data/spec/fixtures/tvrage/search.xml +151 -0
  49. data/spec/fixtures/tvrage/show_info.xml +42 -0
  50. data/spec/fixtures/tvrage/show_info_blank.xml +3 -0
  51. data/spec/fixtures/tvrage/single_episode.xml +8 -0
  52. data/spec/spec.opts +1 -0
  53. metadata +57 -32
@@ -0,0 +1,207 @@
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 name="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>Class: Sofa::TVRage::Schedule</title>
7
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '../..';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <div id="header">
20
+ <div id="menu">
21
+
22
+ <a href="../../_index.html">Index (S)</a> &raquo;
23
+ <a title="Sofa" href="../../Sofa.html">Sofa</a> &raquo; <a title="TVRage" href="../TVRage.html">TVRage</a>
24
+ &raquo;
25
+ <span class="title">Schedule</span>
26
+
27
+ </div>
28
+
29
+ <div id="search">
30
+ <a id="class_list_link" href="#">Namespace List</a>
31
+ <a id="method_list_link" href="#">Method List</a>
32
+ <a id ="file_list_link" href="#">File List</a>
33
+ </div>
34
+
35
+ <div class="clear"></div>
36
+ </div>
37
+
38
+ <iframe id="search_frame"></iframe>
39
+
40
+ <div id="content"><h1>Class: Sofa::TVRage::Schedule
41
+
42
+
43
+ </h1>
44
+
45
+ <dl class="box">
46
+
47
+ <dt class="r1">Inherits:</dt>
48
+ <dd class="r1">
49
+ <span class="inheritName">Object</span>
50
+
51
+ </dd>
52
+
53
+
54
+
55
+
56
+
57
+
58
+ <dt class="r2">Includes:</dt>
59
+ <dd class="r2">HTTParty</dd>
60
+
61
+
62
+
63
+
64
+ <dt class="r1 last">Defined in:</dt>
65
+ <dd class="r1 last">lib/sofa/tvrage/schedule.rb</dd>
66
+
67
+ </dl>
68
+ <div class="clear"></div>
69
+
70
+ <h2>Overview</h2><div class="docstring">
71
+ <div class="discussion">
72
+ <p>This class will hold the full/quick schedule information as per the TVRage API.</p>
73
+
74
+ </div>
75
+ </div>
76
+ <div class="tags">
77
+
78
+ <h3>See Also:</h3>
79
+ <ul class="see">
80
+
81
+ <li><a title="TVRage API : Full Schedule" href="http://services.tvrage.com/index.php?page=public&go=fullschedule">TVRage API : Full Schedule</a></li>
82
+
83
+ <li><a title="TV Rage API : Quick Schedule" href="http://services.tvrage.com/index.php?page=public&go=quickschedule">TV Rage API : Quick Schedule</a></li>
84
+
85
+ </ul>
86
+
87
+ </div>
88
+
89
+
90
+
91
+ <h2>Method Summary</h2>
92
+ <ul class="summary">
93
+
94
+ <li class="public ">
95
+ <span class="summary_signature"><a title="full (class method)" href="#full-class_method">+ (Hash) <strong>full</strong>(country) </a>
96
+
97
+ </span>
98
+
99
+
100
+
101
+
102
+
103
+
104
+ <span class="summary_desc">Gets the full schedule for country.</span>
105
+
106
+ </li>
107
+
108
+
109
+ </ul>
110
+
111
+
112
+
113
+
114
+ <div id="method_details">
115
+ <h2>Method Details</h2>
116
+
117
+ <div class="method_details first">
118
+ <p class="signature first" id="full-class_method">
119
+
120
+ + (<tt>Hash</tt>) <strong>full</strong>(country)
121
+
122
+
123
+
124
+ </p><div class="docstring">
125
+ <div class="discussion">
126
+ <p>Gets the full schedule for country</p>
127
+
128
+ </div>
129
+ </div>
130
+ <div class="tags">
131
+ <h3>Parameters:</h3>
132
+ <ul class="param">
133
+
134
+ <li>
135
+
136
+ <span class='type'>(<tt>String</tt>)</span>
137
+
138
+
139
+ <span class='name'>country</span>
140
+
141
+
142
+
143
+ &mdash;
144
+ The country to query in (US, UK, NL)
145
+
146
+ </li>
147
+
148
+ </ul>
149
+ <h3>Returns:</h3>
150
+ <ul class="return">
151
+
152
+ <li>
153
+
154
+ <span class='type'>(<tt>Hash</tt>)</span>
155
+
156
+
157
+
158
+
159
+ &mdash;
160
+ The parsed XML of schedule information
161
+
162
+ </li>
163
+
164
+ </ul>
165
+
166
+ <h3>See Also:</h3>
167
+ <ul class="see">
168
+
169
+ <li><a title="US's Full Schedule" href="http://services.tvrage.com/feeds/fullschedule.php?country=US">US's Full Schedule</a></li>
170
+
171
+ </ul>
172
+
173
+ </div><table class="source_code">
174
+ <tr>
175
+ <td>
176
+ <pre class="lines">
177
+
178
+
179
+ 18
180
+ 19
181
+ 20
182
+ 21</pre>
183
+ </td>
184
+ <td>
185
+ <pre class="code"><span class="info file"># File 'lib/sofa/tvrage/schedule.rb', line 18</span>
186
+
187
+ def full(country)
188
+ xml = get("/fullschedule.php", :query => {:country => country})
189
+ xml["schedule"]
190
+ end</pre>
191
+ </td>
192
+ </tr>
193
+ </table>
194
+ </div>
195
+
196
+ </div>
197
+
198
+ </div>
199
+
200
+ <div id="footer">
201
+ Generated on Sat Nov 21 20:13:53 2009 by
202
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
203
+ 0.4.0 (ruby-1.8.7).
204
+ </div>
205
+
206
+ </body>
207
+ </html>
@@ -0,0 +1,236 @@
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 name="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>Class: Sofa::TVRage::Season</title>
7
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '../..';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <div id="header">
20
+ <div id="menu">
21
+
22
+ <a href="../../_index.html">Index (S)</a> &raquo;
23
+ <a title="Sofa" href="../../Sofa.html">Sofa</a> &raquo; <a title="TVRage" href="../TVRage.html">TVRage</a>
24
+ &raquo;
25
+ <span class="title">Season</span>
26
+
27
+ </div>
28
+
29
+ <div id="search">
30
+ <a id="class_list_link" href="#">Namespace List</a>
31
+ <a id="method_list_link" href="#">Method List</a>
32
+ <a id ="file_list_link" href="#">File List</a>
33
+ </div>
34
+
35
+ <div class="clear"></div>
36
+ </div>
37
+
38
+ <iframe id="search_frame"></iframe>
39
+
40
+ <div id="content"><h1>Class: Sofa::TVRage::Season
41
+
42
+
43
+ </h1>
44
+
45
+ <dl class="box">
46
+
47
+ <dt class="r1">Inherits:</dt>
48
+ <dd class="r1">
49
+ <span class="inheritName">Object</span>
50
+
51
+ </dd>
52
+
53
+
54
+
55
+
56
+
57
+
58
+ <dt class="r2">Includes:</dt>
59
+ <dd class="r2"><a title="Sofa::Mapping" href="../Mapping.html">Sofa::Mapping</a></dd>
60
+
61
+
62
+
63
+
64
+ <dt class="r1 last">Defined in:</dt>
65
+ <dd class="r1 last">lib/sofa/tvrage/season.rb</dd>
66
+
67
+ </dl>
68
+ <div class="clear"></div>
69
+
70
+ <h2>Overview</h2><div class="docstring">
71
+ <div class="discussion">
72
+ <p>This class holds the XML information of a single season as per the TVRage API.</p>
73
+
74
+ </div>
75
+ </div>
76
+ <div class="tags">
77
+
78
+ <h3>See Also:</h3>
79
+ <ul class="see">
80
+
81
+ <li><a title="TVRage API : Episode List" href="http://services.tvrage.com/index.php?page=public">TVRage API : Episode List</a></li>
82
+
83
+ </ul>
84
+
85
+ </div>
86
+
87
+
88
+
89
+
90
+
91
+
92
+ <h2>Method Summary</h2>
93
+ <ul class="summary">
94
+
95
+ <li class="public ">
96
+ <span class="summary_signature"><a title="#initialize (instance method)" href="#initialize-instance_method">- (Season) <strong>initialize</strong>(info) </a>
97
+
98
+ </span>
99
+
100
+
101
+
102
+
103
+
104
+
105
+ <span class="summary_desc">Returns a new instance of Season, mapping info from the TVRage API.</span>
106
+
107
+ </li>
108
+
109
+
110
+ </ul>
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <h3 class="inherited">Methods included from <a title="Sofa::Mapping" href="../Mapping.html">Sofa::Mapping</a></h3>
119
+ <p class="inherited"><a title="included" href="../Mapping.html#included-class_method">included</a></p>
120
+ <div id="constructor_details">
121
+ <h2>Constructor Details</h2>
122
+
123
+ <div class="method_details first">
124
+ <p class="signature first" id="initialize-instance_method">
125
+
126
+ - (<tt><a title="Season" href="">Season</a></tt>) <strong>initialize</strong>(info)
127
+
128
+
129
+
130
+ </p><div class="docstring">
131
+ <div class="discussion">
132
+ <p>Returns a new instance of Season, mapping info from the TVRage API</p>
133
+
134
+ </div>
135
+ </div>
136
+ <div class="tags">
137
+ <h3>Parameters:</h3>
138
+ <ul class="param">
139
+
140
+ <li>
141
+
142
+ <span class='type'>(<tt>Hash&lt;Symbol, Object&gt;</tt>)</span>
143
+
144
+
145
+ <span class='name'>info</span>
146
+
147
+
148
+
149
+ &mdash;
150
+ Info to initialize with
151
+
152
+ </li>
153
+
154
+ </ul>
155
+
156
+
157
+
158
+
159
+ <h3>Options Hash (<tt>info</tt>):</h3>
160
+ <ul class="option">
161
+
162
+ <li>
163
+ <span class="type">(<tt>String</tt>)</span>
164
+ <span class="name">:no</span>
165
+ <span class="default">
166
+
167
+ <span class="na">N/A</span>
168
+
169
+ </span>
170
+ &mdash;The season number
171
+ </tr>
172
+
173
+ <li>
174
+ <span class="type">(<tt>String</tt>)</span>
175
+ <span class="name">:episode</span>
176
+ <span class="default">
177
+
178
+ <span class="na">N/A</span>
179
+
180
+ </span>
181
+ &mdash;The collection of episodes
182
+ </tr>
183
+
184
+ </ul>
185
+
186
+ <h3>Returns:</h3>
187
+ <ul class="return">
188
+
189
+ <li>
190
+
191
+ <span class='type'>(<tt><a title="Season" href="">Season</a></tt>)</span>
192
+
193
+
194
+
195
+
196
+ &mdash;
197
+ a new instance of +Season+
198
+
199
+ </li>
200
+
201
+ </ul>
202
+
203
+ </div><table class="source_code">
204
+ <tr>
205
+ <td>
206
+ <pre class="lines">
207
+
208
+
209
+ 31
210
+ 32
211
+ 33</pre>
212
+ </td>
213
+ <td>
214
+ <pre class="code"><span class="info file"># File 'lib/sofa/tvrage/season.rb', line 31</span>
215
+
216
+ def initialize(info)
217
+ update_with_mapping(info)
218
+ end</pre>
219
+ </td>
220
+ </tr>
221
+ </table>
222
+ </div>
223
+
224
+ </div>
225
+
226
+
227
+ </div>
228
+
229
+ <div id="footer">
230
+ Generated on Sat Nov 21 20:13:53 2009 by
231
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
232
+ 0.4.0 (ruby-1.8.7).
233
+ </div>
234
+
235
+ </body>
236
+ </html>
@@ -0,0 +1,904 @@
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 name="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>Class: Sofa::TVRage::Show</title>
7
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '../..';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <div id="header">
20
+ <div id="menu">
21
+
22
+ <a href="../../_index.html">Index (S)</a> &raquo;
23
+ <a title="Sofa" href="../../Sofa.html">Sofa</a> &raquo; <a title="TVRage" href="../TVRage.html">TVRage</a>
24
+ &raquo;
25
+ <span class="title">Show</span>
26
+
27
+ </div>
28
+
29
+ <div id="search">
30
+ <a id="class_list_link" href="#">Namespace List</a>
31
+ <a id="method_list_link" href="#">Method List</a>
32
+ <a id ="file_list_link" href="#">File List</a>
33
+ </div>
34
+
35
+ <div class="clear"></div>
36
+ </div>
37
+
38
+ <iframe id="search_frame"></iframe>
39
+
40
+ <div id="content"><h1>Class: Sofa::TVRage::Show
41
+
42
+
43
+ </h1>
44
+
45
+ <dl class="box">
46
+
47
+ <dt class="r1">Inherits:</dt>
48
+ <dd class="r1">
49
+ <span class="inheritName">Object</span>
50
+
51
+ </dd>
52
+
53
+
54
+
55
+
56
+
57
+
58
+ <dt class="r2">Includes:</dt>
59
+ <dd class="r2">HTTParty, <a title="Sofa::Mapping" href="../Mapping.html">Sofa::Mapping</a></dd>
60
+
61
+
62
+
63
+
64
+ <dt class="r1 last">Defined in:</dt>
65
+ <dd class="r1 last">lib/sofa/tvrage/show.rb</dd>
66
+
67
+ </dl>
68
+ <div class="clear"></div>
69
+
70
+ <h2>Overview</h2><div class="docstring">
71
+ <div class="discussion">
72
+ <p>This class holds the XML information of a single Show as per the TVRage API. It&#8217;s also the root point for communicating with the API.</p>
73
+
74
+ </div>
75
+ </div>
76
+ <div class="tags">
77
+
78
+ <h3>See Also:</h3>
79
+ <ul class="see">
80
+
81
+ <li><a title="TVRage API" href="http://services.tvrage.com/index.php?page=public">TVRage API</a></li>
82
+
83
+ </ul>
84
+
85
+ </div>
86
+
87
+
88
+
89
+
90
+
91
+
92
+ <h2>Attribute Summary</h2>
93
+ <ul class="summary">
94
+
95
+ <li class="public ">
96
+ <span class="summary_signature"><a title="#greedy (instance method)" href="#greedy-instance_method">- (Hash) <strong>greedy</strong> </a>
97
+
98
+ </span>
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ <span class="summary_desc">Stores all the info that was greedy-loaded.</span>
109
+
110
+ </li>
111
+
112
+
113
+ </ul>
114
+
115
+
116
+ <h2>Method Summary</h2>
117
+ <ul class="summary">
118
+
119
+ <li class="public ">
120
+ <span class="summary_signature"><a title="by_name (class method)" href="#by_name-class_method">+ (Show) <strong>by_name</strong>(name, options = {}) </a>
121
+
122
+ </span>
123
+
124
+
125
+
126
+
127
+
128
+
129
+ <span class="summary_desc">Finds the Show by name using TVRage&#8217;s Quickinfo API.</span>
130
+
131
+ </li>
132
+
133
+
134
+ <li class="public ">
135
+ <span class="summary_signature"><a title="episode_list (class method)" href="#episode_list-class_method">+ (Hash) <strong>episode_list</strong>(sid) </a>
136
+
137
+ </span>
138
+
139
+
140
+
141
+
142
+
143
+
144
+ <span class="summary_desc">Gets the episode list for a Show.</span>
145
+
146
+ </li>
147
+
148
+
149
+ <li class="public ">
150
+ <span class="summary_signature"><a title="full_info (class method)" href="#full_info-class_method">+ (Hash) <strong>full_info</strong>(sid) </a>
151
+
152
+ </span>
153
+
154
+
155
+
156
+
157
+
158
+
159
+ <span class="summary_desc">Gets the full show info (info + season list + episode list) for a Show.</span>
160
+
161
+ </li>
162
+
163
+
164
+ <li class="public ">
165
+ <span class="summary_signature"><a title="info (class method)" href="#info-class_method">+ (Hash) <strong>info</strong>(sid) </a>
166
+
167
+ </span>
168
+
169
+
170
+
171
+
172
+
173
+
174
+ <span class="summary_desc">Gets the info for a Show.</span>
175
+
176
+ </li>
177
+
178
+
179
+ <li class="public ">
180
+ <span class="summary_signature"><a title="#episode_list (instance method)" href="#episode_list-instance_method">- (Array) <strong>episode_list</strong> </a>
181
+
182
+ </span>
183
+
184
+
185
+
186
+
187
+
188
+
189
+ <span class="summary_desc">The list of episodes.</span>
190
+
191
+ </li>
192
+
193
+
194
+ <li class="public ">
195
+ <span class="summary_signature"><a title="#initialize (instance method)" href="#initialize-instance_method">- (Show) <strong>initialize</strong>(id, options = {}) </a>
196
+
197
+ </span>
198
+
199
+
200
+
201
+
202
+
203
+
204
+ <span class="summary_desc">Returns a new instance of Show, loading and then mapping info from the TVRage API.</span>
205
+
206
+ </li>
207
+
208
+
209
+ <li class="public ">
210
+ <span class="summary_signature"><a title="#season_list (instance method)" href="#season_list-instance_method">- (Array) <strong>season_list</strong> </a>
211
+
212
+ </span>
213
+
214
+
215
+
216
+
217
+
218
+
219
+ <span class="summary_desc">The list of seasons.</span>
220
+
221
+ </li>
222
+
223
+
224
+ </ul>
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+ <h3 class="inherited">Methods included from <a title="Sofa::Mapping" href="../Mapping.html">Sofa::Mapping</a></h3>
234
+ <p class="inherited"><a title="included" href="../Mapping.html#included-class_method">included</a></p>
235
+ <div id="constructor_details">
236
+ <h2>Constructor Details</h2>
237
+
238
+ <div class="method_details first">
239
+ <p class="signature first" id="initialize-instance_method">
240
+
241
+ - (<tt><a title="Show" href="">Show</a></tt>) <strong>initialize</strong>(id, options = {})
242
+
243
+
244
+
245
+ </p><div class="docstring">
246
+ <div class="discussion">
247
+ <p>Returns a new instance of Show, loading and then mapping info from the TVRage API.</p>
248
+
249
+ </div>
250
+ </div>
251
+ <div class="tags">
252
+ <h3>Parameters:</h3>
253
+ <ul class="param">
254
+
255
+ <li>
256
+
257
+ <span class='type'>(<tt>String</tt>)</span>
258
+
259
+
260
+ <span class='name'>id</span>
261
+
262
+
263
+
264
+ &mdash;
265
+ The show_id as per the TVRage API
266
+
267
+ </li>
268
+
269
+ </ul>
270
+
271
+
272
+
273
+
274
+
275
+
276
+ <h3>Options Hash (<tt>options</tt>):</h3>
277
+ <ul class="option">
278
+
279
+ <li>
280
+ <span class="type">(<tt>Boolean</tt>)</span>
281
+ <span class="name">:greedy</span>
282
+ <span class="default">
283
+
284
+ <span class="na">N/A</span>
285
+
286
+ </span>
287
+ &mdash;Whether or not to eager load the Season and Episode info
288
+ </tr>
289
+
290
+ </ul>
291
+
292
+ <h3>Returns:</h3>
293
+ <ul class="return">
294
+
295
+ <li>
296
+
297
+ <span class='type'>(<tt><a title="Show" href="">Show</a></tt>)</span>
298
+
299
+
300
+
301
+
302
+ &mdash;
303
+ a new instance of +Show+
304
+
305
+ </li>
306
+
307
+ </ul>
308
+ <h3>Raises:</h3>
309
+ <ul class="raise">
310
+
311
+ <li>
312
+
313
+ <span class='type'>(<tt>RuntimeError</tt>)</span>
314
+
315
+
316
+
317
+
318
+ </li>
319
+
320
+ </ul>
321
+
322
+ </div><table class="source_code">
323
+ <tr>
324
+ <td>
325
+ <pre class="lines">
326
+
327
+
328
+ 107
329
+ 108
330
+ 109
331
+ 110
332
+ 111
333
+ 112
334
+ 113
335
+ 114
336
+ 115</pre>
337
+ </td>
338
+ <td>
339
+ <pre class="code"><span class="info file"># File 'lib/sofa/tvrage/show.rb', line 107</span>
340
+
341
+ def initialize(id, options = {})
342
+ raise RuntimeError.new("id is required") unless (@show_id = id)
343
+ klass = self.class
344
+ if options[:greedy]
345
+ update_with_mapping(@greedy = klass.full_info(@show_id))
346
+ else
347
+ update_with_mapping(klass.info(@show_id))
348
+ end
349
+ end</pre>
350
+ </td>
351
+ </tr>
352
+ </table>
353
+ </div>
354
+
355
+ </div>
356
+
357
+ <div id="attr_details">
358
+ <h2>Attribute Details</h2>
359
+
360
+
361
+ <span id="greedy=-instance_method"></span>
362
+ <span id="greedy-instance_method"></span>
363
+ <div class="method_details first">
364
+ <p class="signature first" id="greedy-instance_method">
365
+
366
+ - (<tt>Hash</tt>) <strong>greedy</strong>
367
+
368
+
369
+
370
+ </p><div class="docstring">
371
+ <div class="discussion">
372
+ <p>Stores all the info that was greedy-loaded</p>
373
+
374
+ </div>
375
+ </div>
376
+ <div class="tags">
377
+ <h3>Returns:</h3>
378
+ <ul class="return">
379
+
380
+ <li>
381
+
382
+ <span class='type'>(<tt>Hash</tt>)</span>
383
+
384
+
385
+
386
+
387
+ &mdash;
388
+ The full show info (including seasons and episodes)
389
+
390
+ </li>
391
+
392
+ </ul>
393
+
394
+ <h3>See Also:</h3>
395
+ <ul class="see">
396
+
397
+ <li><a title="Show.full_info" href="#full_info-class_method">Show.full_info</a></li>
398
+
399
+ </ul>
400
+
401
+ </div><table class="source_code">
402
+ <tr>
403
+ <td>
404
+ <pre class="lines">
405
+
406
+
407
+ 101
408
+ 102
409
+ 103</pre>
410
+ </td>
411
+ <td>
412
+ <pre class="code"><span class="info file"># File 'lib/sofa/tvrage/show.rb', line 101</span>
413
+
414
+ def greedy
415
+ @greedy
416
+ end</pre>
417
+ </td>
418
+ </tr>
419
+ </table>
420
+ </div>
421
+
422
+ </div>
423
+
424
+
425
+ <div id="method_details">
426
+ <h2>Method Details</h2>
427
+
428
+ <div class="method_details first">
429
+ <p class="signature first" id="by_name-class_method">
430
+
431
+ + (<tt><a title="Show" href="">Show</a></tt>) <strong>by_name</strong>(name, options = {})
432
+
433
+
434
+
435
+ </p><div class="docstring">
436
+ <div class="discussion">
437
+ <p>Finds the Show by name using TVRage&#8217;s Quickinfo API.</p>
438
+
439
+ </div>
440
+ </div>
441
+ <div class="tags">
442
+ <h3>Parameters:</h3>
443
+ <ul class="param">
444
+
445
+ <li>
446
+
447
+ <span class='type'>(<tt>String</tt>)</span>
448
+
449
+
450
+ <span class='name'>name</span>
451
+
452
+
453
+
454
+ &mdash;
455
+ The name of the show to search for
456
+
457
+ </li>
458
+
459
+ </ul>
460
+
461
+
462
+
463
+
464
+
465
+
466
+ <h3>Options Hash (<tt>options</tt>):</h3>
467
+ <ul class="option">
468
+
469
+ <li>
470
+ <span class="type">(<tt>Boolean</tt>)</span>
471
+ <span class="name">:greedy</span>
472
+ <span class="default">
473
+
474
+ <span class="na">N/A</span>
475
+
476
+ </span>
477
+ &mdash;Whether or not to eager load the Season and Episode info
478
+ </tr>
479
+
480
+ </ul>
481
+
482
+ <h3>Returns:</h3>
483
+ <ul class="return">
484
+
485
+ <li>
486
+
487
+ <span class='type'>(<tt><a title="Show" href="">Show</a></tt>)</span>
488
+
489
+
490
+
491
+
492
+ &mdash;
493
+ The show with id parsed from the Quickinfo search
494
+
495
+ </li>
496
+
497
+ </ul>
498
+ <h3>Raises:</h3>
499
+ <ul class="raise">
500
+
501
+ <li>
502
+
503
+ <span class='type'>(<tt><a title="ShowNotFound" href="Show/ShowNotFound.html">ShowNotFound</a></tt>)</span>
504
+
505
+
506
+
507
+
508
+ </li>
509
+
510
+ </ul>
511
+
512
+ <h3>See Also:</h3>
513
+ <ul class="see">
514
+
515
+ <li><a title="TVRage Quickinfo API" href="http://services.tvrage.com/index.php?page=public&go=quickinfo">TVRage Quickinfo API</a></li>
516
+
517
+ <li><a title="Chuck's Quickinfo" href="http://services.tvrage.com/tools/quickinfo.php?show=Chuck">Chuck's Quickinfo</a></li>
518
+
519
+ </ul>
520
+
521
+ </div><table class="source_code">
522
+ <tr>
523
+ <td>
524
+ <pre class="lines">
525
+
526
+
527
+ 50
528
+ 51
529
+ 52
530
+ 53
531
+ 54
532
+ 55
533
+ 56</pre>
534
+ </td>
535
+ <td>
536
+ <pre class="code"><span class="info file"># File 'lib/sofa/tvrage/show.rb', line 50</span>
537
+
538
+ def by_name(name, options = {})
539
+ html = get('/tools/quickinfo.php', :query => {:show => name}, :format => :html)
540
+ show_info = Crack::XML.parse(html)["pre"]
541
+ raise ShowNotFound unless show_info
542
+ id = show_info.split("\n").first.gsub(%r{^Show ID@}, '').strip
543
+ Show.new(id, options)
544
+ end</pre>
545
+ </td>
546
+ </tr>
547
+ </table>
548
+ </div>
549
+
550
+ <div class="method_details ">
551
+ <p class="signature " id="episode_list-class_method">
552
+
553
+ + (<tt>Hash</tt>) <strong>episode_list</strong>(sid)
554
+
555
+
556
+
557
+ </p><div class="docstring">
558
+ <div class="discussion">
559
+ <p>Gets the episode list for a Show.</p>
560
+
561
+ </div>
562
+ </div>
563
+ <div class="tags">
564
+ <h3>Parameters:</h3>
565
+ <ul class="param">
566
+
567
+ <li>
568
+
569
+ <span class='type'>(<tt>String</tt>)</span>
570
+
571
+
572
+ <span class='name'>sid</span>
573
+
574
+
575
+
576
+ &mdash;
577
+ The show&#8217;s id
578
+
579
+ </li>
580
+
581
+ </ul>
582
+ <h3>Returns:</h3>
583
+ <ul class="return">
584
+
585
+ <li>
586
+
587
+ <span class='type'>(<tt>Hash</tt>)</span>
588
+
589
+
590
+
591
+
592
+ &mdash;
593
+ The parsed XML
594
+
595
+ </li>
596
+
597
+ </ul>
598
+
599
+ <h3>See Also:</h3>
600
+ <ul class="see">
601
+
602
+ <li><a title="Chuck's Episode List" href="http://services.tvrage.com/feeds/episode_list.php?sid=15614">Chuck's Episode List</a></li>
603
+
604
+ </ul>
605
+
606
+ </div><table class="source_code">
607
+ <tr>
608
+ <td>
609
+ <pre class="lines">
610
+
611
+
612
+ 38
613
+ 39
614
+ 40
615
+ 41</pre>
616
+ </td>
617
+ <td>
618
+ <pre class="code"><span class="info file"># File 'lib/sofa/tvrage/show.rb', line 38</span>
619
+
620
+ def episode_list(sid)
621
+ xml = get('/feeds/episode_list.php', :query => {:sid => sid})
622
+ xml["Show"]
623
+ end</pre>
624
+ </td>
625
+ </tr>
626
+ </table>
627
+ </div>
628
+
629
+ <div class="method_details ">
630
+ <p class="signature " id="full_info-class_method">
631
+
632
+ + (<tt>Hash</tt>) <strong>full_info</strong>(sid)
633
+
634
+
635
+
636
+ </p><div class="docstring">
637
+ <div class="discussion">
638
+ <p>Gets the full show info (info + season list + episode list) for a Show.</p>
639
+
640
+ </div>
641
+ </div>
642
+ <div class="tags">
643
+ <h3>Parameters:</h3>
644
+ <ul class="param">
645
+
646
+ <li>
647
+
648
+ <span class='type'>(<tt>String</tt>)</span>
649
+
650
+
651
+ <span class='name'>sid</span>
652
+
653
+
654
+
655
+ &mdash;
656
+ The show&#8217;s id
657
+
658
+ </li>
659
+
660
+ </ul>
661
+ <h3>Returns:</h3>
662
+ <ul class="return">
663
+
664
+ <li>
665
+
666
+ <span class='type'>(<tt>Hash</tt>)</span>
667
+
668
+
669
+
670
+
671
+ &mdash;
672
+ The parsed XML
673
+
674
+ </li>
675
+
676
+ </ul>
677
+
678
+ <h3>See Also:</h3>
679
+ <ul class="see">
680
+
681
+ <li><a title="Chuck's Full Show Info" href="http://services.tvrage.com/feeds/full_show_info.php?sid=15614">Chuck's Full Show Info</a></li>
682
+
683
+ </ul>
684
+
685
+ </div><table class="source_code">
686
+ <tr>
687
+ <td>
688
+ <pre class="lines">
689
+
690
+
691
+ 28
692
+ 29
693
+ 30
694
+ 31</pre>
695
+ </td>
696
+ <td>
697
+ <pre class="code"><span class="info file"># File 'lib/sofa/tvrage/show.rb', line 28</span>
698
+
699
+ def full_info(sid)
700
+ xml = get('/feeds/full_show_info.php', :query => {:sid => sid})
701
+ xml["Show"]
702
+ end</pre>
703
+ </td>
704
+ </tr>
705
+ </table>
706
+ </div>
707
+
708
+ <div class="method_details ">
709
+ <p class="signature " id="info-class_method">
710
+
711
+ + (<tt>Hash</tt>) <strong>info</strong>(sid)
712
+
713
+
714
+
715
+ </p><div class="docstring">
716
+ <div class="discussion">
717
+ <p>Gets the info for a Show.</p>
718
+
719
+ </div>
720
+ </div>
721
+ <div class="tags">
722
+ <h3>Parameters:</h3>
723
+ <ul class="param">
724
+
725
+ <li>
726
+
727
+ <span class='type'>(<tt>String</tt>)</span>
728
+
729
+
730
+ <span class='name'>sid</span>
731
+
732
+
733
+
734
+ &mdash;
735
+ The show&#8217;s id
736
+
737
+ </li>
738
+
739
+ </ul>
740
+ <h3>Returns:</h3>
741
+ <ul class="return">
742
+
743
+ <li>
744
+
745
+ <span class='type'>(<tt>Hash</tt>)</span>
746
+
747
+
748
+
749
+
750
+ &mdash;
751
+ The parsed XML
752
+
753
+ </li>
754
+
755
+ </ul>
756
+
757
+ <h3>See Also:</h3>
758
+ <ul class="see">
759
+
760
+ <li><a title="Chuck's Show Info" href="http://services.tvrage.com/feeds/showinfo.php?sid=15614">Chuck's Show Info</a></li>
761
+
762
+ </ul>
763
+
764
+ </div><table class="source_code">
765
+ <tr>
766
+ <td>
767
+ <pre class="lines">
768
+
769
+
770
+ 18
771
+ 19
772
+ 20
773
+ 21</pre>
774
+ </td>
775
+ <td>
776
+ <pre class="code"><span class="info file"># File 'lib/sofa/tvrage/show.rb', line 18</span>
777
+
778
+ def info(sid)
779
+ xml = get('/feeds/showinfo.php', :query => {:sid => sid})
780
+ xml["Showinfo"]
781
+ end</pre>
782
+ </td>
783
+ </tr>
784
+ </table>
785
+ </div>
786
+
787
+ <div class="method_details ">
788
+ <p class="signature " id="episode_list-instance_method">
789
+
790
+ - (<tt>Array</tt>) <strong>episode_list</strong>
791
+
792
+
793
+
794
+ </p><div class="docstring">
795
+ <div class="discussion">
796
+ <p>The list of episodes</p>
797
+
798
+ </div>
799
+ </div>
800
+ <div class="tags">
801
+ <h3>Returns:</h3>
802
+ <ul class="return">
803
+
804
+ <li>
805
+
806
+ <span class='type'>(<tt>Array</tt>)</span>
807
+
808
+
809
+
810
+
811
+ &mdash;
812
+ The list of episodes
813
+
814
+ </li>
815
+
816
+ </ul>
817
+
818
+ </div><table class="source_code">
819
+ <tr>
820
+ <td>
821
+ <pre class="lines">
822
+
823
+
824
+ 124
825
+ 125
826
+ 126</pre>
827
+ </td>
828
+ <td>
829
+ <pre class="code"><span class="info file"># File 'lib/sofa/tvrage/show.rb', line 124</span>
830
+
831
+ def episode_list
832
+ season_list.map { |season| season.episodes }.flatten
833
+ end</pre>
834
+ </td>
835
+ </tr>
836
+ </table>
837
+ </div>
838
+
839
+ <div class="method_details ">
840
+ <p class="signature " id="season_list-instance_method">
841
+
842
+ - (<tt>Array</tt>) <strong>season_list</strong>
843
+
844
+
845
+
846
+ </p><div class="docstring">
847
+ <div class="discussion">
848
+ <p>The list of seasons</p>
849
+
850
+ </div>
851
+ </div>
852
+ <div class="tags">
853
+ <h3>Returns:</h3>
854
+ <ul class="return">
855
+
856
+ <li>
857
+
858
+ <span class='type'>(<tt>Array</tt>)</span>
859
+
860
+
861
+
862
+
863
+ &mdash;
864
+ The list of seasons
865
+
866
+ </li>
867
+
868
+ </ul>
869
+
870
+ </div><table class="source_code">
871
+ <tr>
872
+ <td>
873
+ <pre class="lines">
874
+
875
+
876
+ 118
877
+ 119
878
+ 120
879
+ 121</pre>
880
+ </td>
881
+ <td>
882
+ <pre class="code"><span class="info file"># File 'lib/sofa/tvrage/show.rb', line 118</span>
883
+
884
+ def season_list
885
+ update_with_mapping(self.class.episode_list(@show_id)) unless @season_list
886
+ @season_list
887
+ end</pre>
888
+ </td>
889
+ </tr>
890
+ </table>
891
+ </div>
892
+
893
+ </div>
894
+
895
+ </div>
896
+
897
+ <div id="footer">
898
+ Generated on Sat Nov 21 20:13:53 2009 by
899
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
900
+ 0.4.0 (ruby-1.8.7).
901
+ </div>
902
+
903
+ </body>
904
+ </html>