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,5 @@
1
+ README.md
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,22 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
22
+ .yardoc
@@ -0,0 +1,6 @@
1
+ --readme README.md
2
+ --markup markdown
3
+ --markup-provider maruku
4
+ --protected
5
+ --no-highlight
6
+
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Henry Hsu
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,72 @@
1
+ # Sofa
2
+
3
+ A simple Ruby library for the TVRage API (viewable [here](http://services.tvrage.com/index.php?page=public)).
4
+
5
+ ## Shows
6
+
7
+ Sofa::TVRage::Show.by_name("Chuck") # => #<Sofa::TVRage::Show:0x101360d38 @name="Chuck", @show_id="15614", ...>
8
+ OR
9
+ show = Sofa::TVRage::Show.new("15614") # => #<Sofa::TVRage::Show:0x1012ec3c0 @name="Chuck", @show_id="15614", ...>
10
+
11
+ #### Eager loading Season and Episode info
12
+
13
+ Sofa::TVRage::Show.by_name("Chuck", :greedy => true)
14
+ Sofa::TVRage::Show.new("15614", :greedy => true)
15
+
16
+ #### Attributes
17
+
18
+ show.show_id # => "15614"
19
+ show.name # => "Chuck"
20
+ show.show_link # => "http://tvrage.com/Chuck"
21
+ show.started # => "2007"
22
+ show.network # => "NBC"
23
+ show.air_time # => "20:00"
24
+ show.time_zone # => "GMT-5 -DST"
25
+ show.run_time # => "60"
26
+ show.origin_country # => "US"
27
+ show.air_day # => "Monday"
28
+ show.ended # => nil
29
+ show.classification # => "Scripted"
30
+ show.seasons # => "3"
31
+ show.start_date # => "Sep/24/2007"
32
+ show.status # => "Returning Series"
33
+ show.genres # => ["Action", "Comedy", "Drama"]
34
+ show.akas # => "Chuck"
35
+
36
+ ## Seasons
37
+
38
+ show.season_list # => [#<Sofa::TVRage::Season:0x1022d0f98 @no="1", @episodes=[...]>,
39
+ #<Sofa::TVRage::Season:0x1022c88c0 @no="2", @episodes=[...]>,
40
+ ...]
41
+ season = show.season_list.first # => #<Sofa::TVRage::Season:0x1022d0f98 @no="1", @episodes=[...]>
42
+
43
+ #### Attributes
44
+
45
+ season.episodes # => [#<Sofa::TVRage::Episode:0x1022d07a0 @title="Pilot", ...>,
46
+ #<Sofa::TVRage::Episode:0x1022cf148 @title="Chuck Versus the Helicopter", ...>,
47
+ ...]
48
+ season.no # => "1"
49
+
50
+ ## Episodes
51
+
52
+ show.episode_list # => [#<Sofa::TVRage::Episode:0x1022d07a0 @title="Pilot", ...>,
53
+ #<Sofa::TVRage::Episode:0x1022cf148 @title="Chuck Versus the Helicopter", ...>,
54
+ ...]
55
+ episode = show.episode_list.first # => #<Sofa::TVRage::Episode:0x1022d07a0 @title="Pilot", ...>
56
+
57
+ #### Attributes
58
+
59
+ episode.title # => "Pilot"
60
+ episode.air_date # => "2007-09-24"
61
+ episode.num_in_season # => "01"
62
+ episode.num # => "1"
63
+ episode.prod_num # => "101"
64
+ episode.link # => "http://www.tvrage.com/Chuck/episodes/579282"
65
+
66
+ ## Contributing
67
+
68
+ * Feel free to send feature/pull requests.
69
+
70
+ ## Copyright
71
+
72
+ Copyright (c) 2009 Henry Hsu. See LICENSE for details.
@@ -0,0 +1,76 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ require 'lib/sofa/version'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.name = "sofa"
9
+ gem.version = Sofa::Version::STRING
10
+ gem.summary = %Q{A Ruby library for the TVRage API.}
11
+ gem.description = %Q{A simple Ruby library for the TVRage API.}
12
+ gem.email = "henry@qlane.com"
13
+ gem.homepage = "http://github.com/hsume2/sofa"
14
+ gem.authors = ["Henry Hsu"]
15
+ gem.add_dependency "httparty"
16
+ gem.add_development_dependency "rspec", ">= 1.2.9"
17
+ gem.add_development_dependency "mocha"
18
+ gem.add_development_dependency "fakeweb"
19
+ gem.add_development_dependency "yard", ">= 0"
20
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
21
+ end
22
+ Jeweler::GemcutterTasks.new
23
+ rescue LoadError
24
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
25
+ end
26
+
27
+ require 'spec/rake/spectask'
28
+ Spec::Rake::SpecTask.new(:spec) do |spec|
29
+ spec.libs << 'lib' << 'spec'
30
+ spec.spec_files = FileList['spec/**/*_spec.rb']
31
+ end
32
+
33
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
34
+ spec.libs << 'lib' << 'spec'
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ spec.rcov_opts = %w{--exclude spec/*,gems/*}
38
+ end
39
+
40
+ task :spec => :check_dependencies
41
+
42
+ begin
43
+ require 'reek/adapters/rake_task'
44
+ Reek::RakeTask.new do |t|
45
+ t.fail_on_error = true
46
+ t.verbose = false
47
+ t.source_files = 'lib/**/*.rb'
48
+ end
49
+ rescue LoadError
50
+ task :reek do
51
+ abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
52
+ end
53
+ end
54
+
55
+ begin
56
+ require 'roodi'
57
+ require 'roodi_task'
58
+ RoodiTask.new do |t|
59
+ t.verbose = false
60
+ end
61
+ rescue LoadError
62
+ task :roodi do
63
+ abort "Roodi is not available. In order to run roodi, you must: sudo gem install roodi"
64
+ end
65
+ end
66
+
67
+ task :default => :spec
68
+
69
+ begin
70
+ require 'yard'
71
+ YARD::Rake::YardocTask.new
72
+ rescue LoadError
73
+ task :yardoc do
74
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
75
+ end
76
+ end
@@ -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</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
+
24
+
25
+ <span class="title">Sofa</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
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.rb<span class="defines">,<br />
55
+ lib/sofa/tvrage.rb,<br /> lib/sofa/version.rb,<br /> lib/sofa/mapping.rb,<br /> 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
+ <strong class="modules">Modules:</strong> <a title="Mapping" href="Sofa/Mapping.html">Mapping</a>, <a title="TVRage" href="Sofa/TVRage.html">TVRage</a>, <a title="Version" href="Sofa/Version.html">Version</a>
66
+
67
+
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,168 @@
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::Mapping</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 (M)</a> &raquo;
23
+ <a title="Sofa" href="../Sofa.html">Sofa</a>
24
+ &raquo;
25
+ <span class="title">Mapping</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::Mapping
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/mapping.rb</dd>
55
+
56
+ </dl>
57
+ <div class="clear"></div>
58
+
59
+ <h2>Defined Under Namespace</h2>
60
+ <p class="children">
61
+
62
+
63
+ <strong class="modules">Modules:</strong> <a title="ClassMethods" href="Mapping/ClassMethods.html">ClassMethods</a>, <a title="InstanceMethods" href="Mapping/InstanceMethods.html">InstanceMethods</a>
64
+
65
+
66
+
67
+
68
+ </p>
69
+
70
+
71
+
72
+ <h2>Method Summary</h2>
73
+ <ul class="summary">
74
+
75
+ <li class="public ">
76
+ <span class="summary_signature"><a title="included (class method)" href="#included-class_method">+ (Object) <strong>included</strong>(base) </a>
77
+
78
+ </span>
79
+
80
+
81
+
82
+
83
+
84
+
85
+ <span class="summary_desc">This method is automatically called when <tt><a title="Mapping" href="">Mapping</a></tt> is included in a module.</span>
86
+
87
+ </li>
88
+
89
+
90
+ </ul>
91
+
92
+
93
+
94
+ <div id="method_details">
95
+ <h2>Method Details</h2>
96
+
97
+ <div class="method_details first">
98
+ <p class="signature first" id="included-class_method">
99
+
100
+ + (<tt>Object</tt>) <strong>included</strong>(base)
101
+
102
+
103
+
104
+ </p><div class="docstring">
105
+ <div class="discussion">
106
+ <p>This method is automatically called when <tt><a title="Mapping" href="">Mapping</a></tt> is included in a module. It automatically adds <tt><a title="InstanceMethods" href="Mapping/InstanceMethods.html">InstanceMethods</a></tt>, <tt><a title="ClassMethods" href="Mapping/ClassMethods.html">ClassMethods</a></tt> and initializes @mappings and @mappings_procs to empty Hashes.</p>
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+ <h3>Parameters:</h3>
112
+ <ul class="param">
113
+
114
+ <li>
115
+
116
+ <span class='type'>(<tt>Module</tt>, <tt>Class</tt>)</span>
117
+
118
+
119
+ <span class='name'>base</span>
120
+
121
+
122
+
123
+ &mdash;
124
+ The module that this is included in
125
+
126
+ </li>
127
+
128
+ </ul>
129
+
130
+ </div><table class="source_code">
131
+ <tr>
132
+ <td>
133
+ <pre class="lines">
134
+
135
+
136
+ 8
137
+ 9
138
+ 10
139
+ 11
140
+ 12
141
+ 13</pre>
142
+ </td>
143
+ <td>
144
+ <pre class="code"><span class="info file"># File 'lib/sofa/mapping.rb', line 8</span>
145
+
146
+ def self.included(base)
147
+ base.send(:include, InstanceMethods)
148
+ base.extend(ClassMethods)
149
+ base.instance_variable_set("@mappings", {})
150
+ base.instance_variable_set("@mappings_procs", {})
151
+ end</pre>
152
+ </td>
153
+ </tr>
154
+ </table>
155
+ </div>
156
+
157
+ </div>
158
+
159
+ </div>
160
+
161
+ <div id="footer">
162
+ Generated on Sat Nov 21 20:13:53 2009 by
163
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
164
+ 0.4.0 (ruby-1.8.7).
165
+ </div>
166
+
167
+ </body>
168
+ </html>