sofa 0.1.0

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.
Files changed (64) hide show
  1. data/.document +5 -0
  2. data/.gitignore +22 -0
  3. data/.yardopts +6 -0
  4. data/LICENSE +20 -0
  5. data/README.md +72 -0
  6. data/Rakefile +76 -0
  7. data/doc/Sofa.html +85 -0
  8. data/doc/Sofa/Mapping.html +168 -0
  9. data/doc/Sofa/Mapping/ClassMethods.html +314 -0
  10. data/doc/Sofa/Mapping/InstanceMethods.html +358 -0
  11. data/doc/Sofa/TVRage.html +85 -0
  12. data/doc/Sofa/TVRage/Episode.html +358 -0
  13. data/doc/Sofa/TVRage/Schedule.html +207 -0
  14. data/doc/Sofa/TVRage/Season.html +236 -0
  15. data/doc/Sofa/TVRage/Show.html +904 -0
  16. data/doc/Sofa/TVRage/Show/ShowNotFound.html +92 -0
  17. data/doc/Sofa/Version.html +100 -0
  18. data/doc/_index.html +206 -0
  19. data/doc/class_list.html +137 -0
  20. data/doc/css/common.css +1 -0
  21. data/doc/css/full_list.css +23 -0
  22. data/doc/css/style.css +261 -0
  23. data/doc/file.README.html +120 -0
  24. data/doc/file_list.html +29 -0
  25. data/doc/index.html +120 -0
  26. data/doc/js/app.js +91 -0
  27. data/doc/js/full_list.js +39 -0
  28. data/doc/js/jquery.js +19 -0
  29. data/doc/method_list.html +192 -0
  30. data/doc/top-level-namespace.html +80 -0
  31. data/lib/sofa.rb +5 -0
  32. data/lib/sofa/mapping.rb +108 -0
  33. data/lib/sofa/tvrage.rb +10 -0
  34. data/lib/sofa/tvrage/episode.rb +39 -0
  35. data/lib/sofa/tvrage/schedule.rb +25 -0
  36. data/lib/sofa/tvrage/season.rb +36 -0
  37. data/lib/sofa/tvrage/show.rb +132 -0
  38. data/lib/sofa/version.rb +8 -0
  39. data/sofa.gemspec +126 -0
  40. data/spec/fixtures/tvrage/cases/castle.xml +228 -0
  41. data/spec/fixtures/tvrage/cases/community.xml +109 -0
  42. data/spec/fixtures/tvrage/cases/live_with_regis_and_kelly.xml +56237 -0
  43. data/spec/fixtures/tvrage/episode_list.xml +1183 -0
  44. data/spec/fixtures/tvrage/episode_list_one_season.xml +17 -0
  45. data/spec/fixtures/tvrage/episode_list_two_episodes.xml +25 -0
  46. data/spec/fixtures/tvrage/full_schedule.xml +4731 -0
  47. data/spec/fixtures/tvrage/full_show_info.xml +1291 -0
  48. data/spec/fixtures/tvrage/quickinfo.html +17 -0
  49. data/spec/fixtures/tvrage/quickinfo_missing.html +1 -0
  50. data/spec/fixtures/tvrage/search.xml +151 -0
  51. data/spec/fixtures/tvrage/show_info.xml +42 -0
  52. data/spec/fixtures/tvrage/show_info_blank.xml +3 -0
  53. data/spec/fixtures/tvrage/single_episode.xml +8 -0
  54. data/spec/sofa/mapping_spec.rb +82 -0
  55. data/spec/sofa/tvrage/cases_spec.rb +29 -0
  56. data/spec/sofa/tvrage/episode_spec.rb +45 -0
  57. data/spec/sofa/tvrage/schedule_spec.rb +17 -0
  58. data/spec/sofa/tvrage/season_spec.rb +61 -0
  59. data/spec/sofa/tvrage/show_spec.rb +162 -0
  60. data/spec/sofa/version_spec.rb +11 -0
  61. data/spec/sofa_spec.rb +5 -0
  62. data/spec/spec.opts +1 -0
  63. data/spec/spec_helper.rb +14 -0
  64. metadata +175 -0
@@ -0,0 +1,85 @@
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>Module: Sofa::TVRage</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 (T)</a> &raquo;
23
+ <a title="Sofa" href="../Sofa.html">Sofa</a>
24
+ &raquo;
25
+ <span class="title">TVRage</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>Module: Sofa::TVRage
41
+
42
+
43
+ </h1>
44
+
45
+ <dl class="box">
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+ <dt class="r1 last">Defined in:</dt>
54
+ <dd class="r1 last">lib/sofa/tvrage.rb<span class="defines">,<br />
55
+ lib/sofa/tvrage/show.rb,<br /> lib/sofa/tvrage/season.rb,<br /> lib/sofa/tvrage/episode.rb,<br /> lib/sofa/tvrage/schedule.rb</span>
56
+ </dd>
57
+
58
+ </dl>
59
+ <div class="clear"></div>
60
+
61
+ <h2>Defined Under Namespace</h2>
62
+ <p class="children">
63
+
64
+
65
+
66
+
67
+ <strong class="classes">Classes:</strong> <a title="Episode" href="TVRage/Episode.html">Episode</a>, <a title="Schedule" href="TVRage/Schedule.html">Schedule</a>, <a title="Season" href="TVRage/Season.html">Season</a>, <a title="Show" href="TVRage/Show.html">Show</a>
68
+
69
+
70
+ </p>
71
+
72
+
73
+
74
+
75
+
76
+ </div>
77
+
78
+ <div id="footer">
79
+ Generated on Sat Nov 21 20:13:52 2009 by
80
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
81
+ 0.4.0 (ruby-1.8.7).
82
+ </div>
83
+
84
+ </body>
85
+ </html>
@@ -0,0 +1,358 @@
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::Episode</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 (E)</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">Episode</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::Episode
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/episode.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 episode 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
+ <h2>Attribute Summary</h2>
92
+ <ul class="summary">
93
+
94
+ <li class="public ">
95
+ <span class="summary_signature"><a title="#season_num (instance method)" href="#season_num-instance_method">- (Object) <strong>season_num</strong> </a>
96
+
97
+ </span>
98
+
99
+ <span class="note title readonly">readonly</span>
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ <span class="summary_desc">The season number of the Season this Episode belongs to.</span>
108
+
109
+ </li>
110
+
111
+
112
+ </ul>
113
+
114
+
115
+ <h2>Method Summary</h2>
116
+ <ul class="summary">
117
+
118
+ <li class="public ">
119
+ <span class="summary_signature"><a title="#initialize (instance method)" href="#initialize-instance_method">- (Episode) <strong>initialize</strong>(info) </a>
120
+
121
+ </span>
122
+
123
+
124
+
125
+
126
+
127
+
128
+ <span class="summary_desc">Returns a new instance of Episode, mapping info from the TVRage API.</span>
129
+
130
+ </li>
131
+
132
+
133
+ </ul>
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+ <h3 class="inherited">Methods included from <a title="Sofa::Mapping" href="../Mapping.html">Sofa::Mapping</a></h3>
142
+ <p class="inherited"><a title="included" href="../Mapping.html#included-class_method">included</a></p>
143
+ <div id="constructor_details">
144
+ <h2>Constructor Details</h2>
145
+
146
+ <div class="method_details first">
147
+ <p class="signature first" id="initialize-instance_method">
148
+
149
+ - (<tt><a title="Episode" href="">Episode</a></tt>) <strong>initialize</strong>(info)
150
+
151
+
152
+
153
+ </p><div class="docstring">
154
+ <div class="discussion">
155
+ <p>Returns a new instance of Episode, mapping info from the TVRage API</p>
156
+
157
+ </div>
158
+ </div>
159
+ <div class="tags">
160
+ <h3>Parameters:</h3>
161
+ <ul class="param">
162
+
163
+ <li>
164
+
165
+ <span class='type'>(<tt>Hash&lt;Symbol, Object&gt;</tt>)</span>
166
+
167
+
168
+ <span class='name'>info</span>
169
+
170
+
171
+
172
+ &mdash;
173
+ Info to initialize with
174
+
175
+ </li>
176
+
177
+ </ul>
178
+
179
+
180
+
181
+
182
+ <h3>Options Hash (<tt>info</tt>):</h3>
183
+ <ul class="option">
184
+
185
+ <li>
186
+ <span class="type">(<tt>String</tt>)</span>
187
+ <span class="name">:epnum</span>
188
+ <span class="default">
189
+
190
+ <span class="na">N/A</span>
191
+
192
+ </span>
193
+ &mdash;The episode number in the context of all episodes
194
+ </tr>
195
+
196
+ <li>
197
+ <span class="type">(<tt>String</tt>)</span>
198
+ <span class="name">:seasonnum</span>
199
+ <span class="default">
200
+
201
+ <span class="na">N/A</span>
202
+
203
+ </span>
204
+ &mdash;The episode number in the context of its season
205
+ </tr>
206
+
207
+ <li>
208
+ <span class="type">(<tt>String</tt>)</span>
209
+ <span class="name">:prodnum</span>
210
+ <span class="default">
211
+
212
+ <span class="na">N/A</span>
213
+
214
+ </span>
215
+
216
+ </tr>
217
+
218
+ <li>
219
+ <span class="type">(<tt>String</tt>)</span>
220
+ <span class="name">:airdate</span>
221
+ <span class="default">
222
+
223
+ <span class="na">N/A</span>
224
+
225
+ </span>
226
+ &mdash;The date the episode airs
227
+ </tr>
228
+
229
+ <li>
230
+ <span class="type">(<tt>String</tt>)</span>
231
+ <span class="name">:link</span>
232
+ <span class="default">
233
+
234
+ <span class="na">N/A</span>
235
+
236
+ </span>
237
+ &mdash;The TVRage page for this Episode
238
+ </tr>
239
+
240
+ <li>
241
+ <span class="type">(<tt>String</tt>)</span>
242
+ <span class="name">:title</span>
243
+ <span class="default">
244
+
245
+ <span class="na">N/A</span>
246
+
247
+ </span>
248
+ &mdash;The title of this Episode
249
+ </tr>
250
+
251
+ <li>
252
+ <span class="type">(<tt>String</tt>)</span>
253
+ <span class="name">:season_num</span>
254
+ <span class="default">
255
+
256
+ <span class="na">N/A</span>
257
+
258
+ </span>
259
+ &mdash;The season number of the Season this Episode belongs to
260
+ </tr>
261
+
262
+ </ul>
263
+
264
+ <h3>Returns:</h3>
265
+ <ul class="return">
266
+
267
+ <li>
268
+
269
+ <span class='type'>(<tt><a title="Episode" href="">Episode</a></tt>)</span>
270
+
271
+
272
+
273
+
274
+ &mdash;
275
+ a new instance of +Episode+
276
+
277
+ </li>
278
+
279
+ </ul>
280
+
281
+ </div><table class="source_code">
282
+ <tr>
283
+ <td>
284
+ <pre class="lines">
285
+
286
+
287
+ 34
288
+ 35
289
+ 36</pre>
290
+ </td>
291
+ <td>
292
+ <pre class="code"><span class="info file"># File 'lib/sofa/tvrage/episode.rb', line 34</span>
293
+
294
+ def initialize(info)
295
+ update_with_mapping(info)
296
+ end</pre>
297
+ </td>
298
+ </tr>
299
+ </table>
300
+ </div>
301
+
302
+ </div>
303
+
304
+ <div id="attr_details">
305
+ <h2>Attribute Details</h2>
306
+
307
+
308
+ <span id=""></span>
309
+ <span id="season_num-instance_method"></span>
310
+ <div class="method_details first">
311
+ <p class="signature first" id="season_num-instance_method">
312
+
313
+ - (<tt>Object</tt>) <strong>season_num</strong> <span class="extras">(readonly)</span>
314
+
315
+
316
+
317
+ </p><div class="docstring">
318
+ <div class="discussion">
319
+ <p>The season number of the Season this Episode belongs to. Not actually a part of the TVRage API, but it&#8217;s used to inject the +season_num+ when looping through Episodes in a Season.</p>
320
+
321
+ </div>
322
+ </div>
323
+ <div class="tags">
324
+
325
+ </div><table class="source_code">
326
+ <tr>
327
+ <td>
328
+ <pre class="lines">
329
+
330
+
331
+ 22
332
+ 23
333
+ 24</pre>
334
+ </td>
335
+ <td>
336
+ <pre class="code"><span class="info file"># File 'lib/sofa/tvrage/episode.rb', line 22</span>
337
+
338
+ def season_num
339
+ @season_num
340
+ end</pre>
341
+ </td>
342
+ </tr>
343
+ </table>
344
+ </div>
345
+
346
+ </div>
347
+
348
+
349
+ </div>
350
+
351
+ <div id="footer">
352
+ Generated on Sat Nov 21 20:13:53 2009 by
353
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
354
+ 0.4.0 (ruby-1.8.7).
355
+ </div>
356
+
357
+ </body>
358
+ </html>
@@ -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>