em-sofa 0.1.1
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.
- data/.document +5 -0
- data/.gitignore +22 -0
- data/.yardopts +6 -0
- data/LICENSE +20 -0
- data/README.md +110 -0
- data/Rakefile +75 -0
- data/doc/Em-sofa/Mapping.html +168 -0
- data/doc/Em-sofa/Mapping/ClassMethods.html +314 -0
- data/doc/Em-sofa/Mapping/InstanceMethods.html +358 -0
- data/doc/Em-sofa/TVRage.html +85 -0
- data/doc/Em-sofa/TVRage/Episode.html +358 -0
- data/doc/Em-sofa/TVRage/Schedule.html +207 -0
- data/doc/Em-sofa/TVRage/Season.html +236 -0
- data/doc/Em-sofa/TVRage/Show.html +904 -0
- data/doc/Em-sofa/TVRage/Show/ShowNotFound.html +92 -0
- data/doc/Em-sofa/Version.html +100 -0
- data/doc/Sofa.html +85 -0
- data/doc/_index.html +233 -0
- data/doc/class_list.html +36 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +50 -0
- data/doc/css/style.css +277 -0
- data/doc/file.README.html +150 -0
- data/doc/file_list.html +38 -0
- data/doc/index.html +150 -0
- data/doc/js/app.js +138 -0
- data/doc/js/full_list.js +117 -0
- data/doc/js/jquery.js +19 -0
- data/doc/method_list.html +195 -0
- data/doc/top-level-namespace.html +88 -0
- data/lib/em-sofa.rb +8 -0
- data/lib/em-sofa/mapping.rb +108 -0
- data/lib/em-sofa/tvrage.rb +14 -0
- data/lib/em-sofa/tvrage/episode.rb +41 -0
- data/lib/em-sofa/tvrage/schedule.rb +28 -0
- data/lib/em-sofa/tvrage/season.rb +38 -0
- data/lib/em-sofa/tvrage/show.rb +193 -0
- data/lib/em-sofa/version.rb +10 -0
- data/spec/fixtures/tvrage/cases/castle.xml +228 -0
- data/spec/fixtures/tvrage/cases/community.xml +109 -0
- data/spec/fixtures/tvrage/cases/live_with_regis_and_kelly.xml +56237 -0
- data/spec/fixtures/tvrage/episode_list.xml +1183 -0
- data/spec/fixtures/tvrage/episode_list_one_season.xml +17 -0
- data/spec/fixtures/tvrage/episode_list_two_episodes.xml +25 -0
- data/spec/fixtures/tvrage/full_schedule.xml +4731 -0
- data/spec/fixtures/tvrage/full_show_info.xml +1291 -0
- data/spec/fixtures/tvrage/quickinfo.html +17 -0
- data/spec/fixtures/tvrage/quickinfo_missing.html +1 -0
- data/spec/fixtures/tvrage/search.xml +151 -0
- data/spec/fixtures/tvrage/show_info.xml +42 -0
- data/spec/fixtures/tvrage/show_info_blank.xml +3 -0
- data/spec/fixtures/tvrage/single_episode.xml +8 -0
- data/spec/sofa/mapping_spec.rb +82 -0
- data/spec/sofa/tvrage/cases_spec.rb +29 -0
- data/spec/sofa/tvrage/episode_spec.rb +45 -0
- data/spec/sofa/tvrage/schedule_spec.rb +17 -0
- data/spec/sofa/tvrage/season_spec.rb +61 -0
- data/spec/sofa/tvrage/show_spec.rb +201 -0
- data/spec/sofa/version_spec.rb +11 -0
- data/spec/sofa_spec.rb +5 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +20 -0
- metadata +165 -0
@@ -0,0 +1,195 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta name="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
7
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
9
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
10
|
+
<base id="base_target" target="_parent" />
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<script type="text/javascript" charset="utf-8">
|
14
|
+
if (window.top.frames.main) {
|
15
|
+
document.getElementById('base_target').target = 'main';
|
16
|
+
document.body.className = 'frames';
|
17
|
+
}
|
18
|
+
</script>
|
19
|
+
<div id="content">
|
20
|
+
<h1 id="full_list_header">Method List</h1>
|
21
|
+
<div id="nav">
|
22
|
+
<a target="_self" href="class_list.html">Classes</a> |
|
23
|
+
<a target="_self" href="method_list.html">Methods</a> |
|
24
|
+
<a target="_self" href="file_list.html">Files</a>
|
25
|
+
</div>
|
26
|
+
<div id="search">Search: <input type="text" /></div>
|
27
|
+
|
28
|
+
<ul id="full_list" class="methods">
|
29
|
+
|
30
|
+
|
31
|
+
<li class="r1 ">
|
32
|
+
<a href="EM/Sofa/Mapping/InstanceMethods.html#%3D%3D-instance_method" title="EM::Sofa::Mapping::InstanceMethods#== (method)">#==</a>
|
33
|
+
|
34
|
+
<small>EM::Sofa::Mapping::InstanceMethods</small>
|
35
|
+
|
36
|
+
</li>
|
37
|
+
|
38
|
+
|
39
|
+
<li class="r2 ">
|
40
|
+
<a href="EM/Sofa/Mapping/InstanceMethods.html#attributes-instance_method" title="EM::Sofa::Mapping::InstanceMethods#attributes (method)">#attributes</a>
|
41
|
+
|
42
|
+
<small>EM::Sofa::Mapping::InstanceMethods</small>
|
43
|
+
|
44
|
+
</li>
|
45
|
+
|
46
|
+
|
47
|
+
<li class="r1 ">
|
48
|
+
<a href="EventMachine/Sofa/TVRage/Show.html#by_name-class_method" title="EventMachine::Sofa::TVRage::Show.by_name (method)">by_name</a>
|
49
|
+
|
50
|
+
<small>EventMachine::Sofa::TVRage::Show</small>
|
51
|
+
|
52
|
+
</li>
|
53
|
+
|
54
|
+
|
55
|
+
<li class="r2 ">
|
56
|
+
<a href="EventMachine/Sofa/TVRage/Show.html#episode_list-instance_method" title="EventMachine::Sofa::TVRage::Show#episode_list (method)">#episode_list</a>
|
57
|
+
|
58
|
+
<small>EventMachine::Sofa::TVRage::Show</small>
|
59
|
+
|
60
|
+
</li>
|
61
|
+
|
62
|
+
|
63
|
+
<li class="r1 ">
|
64
|
+
<a href="EventMachine/Sofa/TVRage/Show.html#episode_list-class_method" title="EventMachine::Sofa::TVRage::Show.episode_list (method)">episode_list</a>
|
65
|
+
|
66
|
+
<small>EventMachine::Sofa::TVRage::Show</small>
|
67
|
+
|
68
|
+
</li>
|
69
|
+
|
70
|
+
|
71
|
+
<li class="r2 ">
|
72
|
+
<a href="EventMachine/Sofa/TVRage/Schedule.html#full-class_method" title="EventMachine::Sofa::TVRage::Schedule.full (method)">full</a>
|
73
|
+
|
74
|
+
<small>EventMachine::Sofa::TVRage::Schedule</small>
|
75
|
+
|
76
|
+
</li>
|
77
|
+
|
78
|
+
|
79
|
+
<li class="r1 ">
|
80
|
+
<a href="EventMachine/Sofa/TVRage/Show.html#full_info-class_method" title="EventMachine::Sofa::TVRage::Show.full_info (method)">full_info</a>
|
81
|
+
|
82
|
+
<small>EventMachine::Sofa::TVRage::Show</small>
|
83
|
+
|
84
|
+
</li>
|
85
|
+
|
86
|
+
|
87
|
+
<li class="r2 ">
|
88
|
+
<a href="EventMachine/Sofa/TVRage/Show.html#greedy-instance_method" title="EventMachine::Sofa::TVRage::Show#greedy (method)">#greedy</a>
|
89
|
+
|
90
|
+
<small>EventMachine::Sofa::TVRage::Show</small>
|
91
|
+
|
92
|
+
</li>
|
93
|
+
|
94
|
+
|
95
|
+
<li class="r1 ">
|
96
|
+
<a href="EM/Sofa/Mapping.html#included-class_method" title="EM::Sofa::Mapping.included (method)">included</a>
|
97
|
+
|
98
|
+
<small>EM::Sofa::Mapping</small>
|
99
|
+
|
100
|
+
</li>
|
101
|
+
|
102
|
+
|
103
|
+
<li class="r2 ">
|
104
|
+
<a href="EventMachine/Sofa/TVRage/Show.html#info-class_method" title="EventMachine::Sofa::TVRage::Show.info (method)">info</a>
|
105
|
+
|
106
|
+
<small>EventMachine::Sofa::TVRage::Show</small>
|
107
|
+
|
108
|
+
</li>
|
109
|
+
|
110
|
+
|
111
|
+
<li class="r1 ">
|
112
|
+
<a href="EventMachine/Sofa/TVRage/Episode.html#initialize-instance_method" title="EventMachine::Sofa::TVRage::Episode#initialize (method)">#initialize</a>
|
113
|
+
|
114
|
+
<small>EventMachine::Sofa::TVRage::Episode</small>
|
115
|
+
|
116
|
+
</li>
|
117
|
+
|
118
|
+
|
119
|
+
<li class="r2 ">
|
120
|
+
<a href="EventMachine/Sofa/TVRage/Season.html#initialize-instance_method" title="EventMachine::Sofa::TVRage::Season#initialize (method)">#initialize</a>
|
121
|
+
|
122
|
+
<small>EventMachine::Sofa::TVRage::Season</small>
|
123
|
+
|
124
|
+
</li>
|
125
|
+
|
126
|
+
|
127
|
+
<li class="r1 ">
|
128
|
+
<a href="EventMachine/Sofa/TVRage/Show.html#initialize-instance_method" title="EventMachine::Sofa::TVRage::Show#initialize (method)">#initialize</a>
|
129
|
+
|
130
|
+
<small>EventMachine::Sofa::TVRage::Show</small>
|
131
|
+
|
132
|
+
</li>
|
133
|
+
|
134
|
+
|
135
|
+
<li class="r2 ">
|
136
|
+
<a href="EM/Sofa/Mapping/ClassMethods.html#mappings-instance_method" title="EM::Sofa::Mapping::ClassMethods#mappings (method)">#mappings</a>
|
137
|
+
|
138
|
+
<small>EM::Sofa::Mapping::ClassMethods</small>
|
139
|
+
|
140
|
+
</li>
|
141
|
+
|
142
|
+
|
143
|
+
<li class="r1 ">
|
144
|
+
<a href="EM/Sofa/Mapping/ClassMethods.html#mappings_procs-instance_method" title="EM::Sofa::Mapping::ClassMethods#mappings_procs (method)">#mappings_procs</a>
|
145
|
+
|
146
|
+
<small>EM::Sofa::Mapping::ClassMethods</small>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
|
151
|
+
<li class="r2 ">
|
152
|
+
<a href="EM/Sofa/Mapping/ClassMethods.html#maps-instance_method" title="EM::Sofa::Mapping::ClassMethods#maps (method)">#maps</a>
|
153
|
+
|
154
|
+
<small>EM::Sofa::Mapping::ClassMethods</small>
|
155
|
+
|
156
|
+
</li>
|
157
|
+
|
158
|
+
|
159
|
+
<li class="r1 ">
|
160
|
+
<a href="EventMachine/Sofa/TVRage/Show.html#parsed_quickinfo-class_method" title="EventMachine::Sofa::TVRage::Show.parsed_quickinfo (method)">parsed_quickinfo</a>
|
161
|
+
|
162
|
+
<small>EventMachine::Sofa::TVRage::Show</small>
|
163
|
+
|
164
|
+
</li>
|
165
|
+
|
166
|
+
|
167
|
+
<li class="r2 ">
|
168
|
+
<a href="EventMachine/Sofa/TVRage/Show.html#season_list-instance_method" title="EventMachine::Sofa::TVRage::Show#season_list (method)">#season_list</a>
|
169
|
+
|
170
|
+
<small>EventMachine::Sofa::TVRage::Show</small>
|
171
|
+
|
172
|
+
</li>
|
173
|
+
|
174
|
+
|
175
|
+
<li class="r1 ">
|
176
|
+
<a href="EventMachine/Sofa/TVRage/Episode.html#season_num-instance_method" title="EventMachine::Sofa::TVRage::Episode#season_num (method)">#season_num</a>
|
177
|
+
|
178
|
+
<small>EventMachine::Sofa::TVRage::Episode</small>
|
179
|
+
|
180
|
+
</li>
|
181
|
+
|
182
|
+
|
183
|
+
<li class="r2 ">
|
184
|
+
<a href="EM/Sofa/Mapping/InstanceMethods.html#update_with_mapping-instance_method" title="EM::Sofa::Mapping::InstanceMethods#update_with_mapping (method)">#update_with_mapping</a>
|
185
|
+
|
186
|
+
<small>EM::Sofa::Mapping::InstanceMethods</small>
|
187
|
+
|
188
|
+
</li>
|
189
|
+
|
190
|
+
|
191
|
+
</ul>
|
192
|
+
</div>
|
193
|
+
</body>
|
194
|
+
</html>
|
195
|
+
|
@@ -0,0 +1,88 @@
|
|
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>Top Level Namespace</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
|
+
<script type="text/javascript" charset="utf-8">
|
20
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
21
|
+
</script>
|
22
|
+
|
23
|
+
<div id="header">
|
24
|
+
<div id="menu">
|
25
|
+
|
26
|
+
<a href="_index.html">Index</a> »
|
27
|
+
|
28
|
+
|
29
|
+
<span class="title">Top Level Namespace</span>
|
30
|
+
|
31
|
+
|
32
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="search">
|
36
|
+
<a id="class_list_link" href="#">Class List</a>
|
37
|
+
<a id="method_list_link" href="#">Method List</a>
|
38
|
+
<a id ="file_list_link" href="#">File List</a>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div class="clear"></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<iframe id="search_frame"></iframe>
|
45
|
+
|
46
|
+
<div id="content"><h1>Top Level Namespace
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
</h1>
|
51
|
+
|
52
|
+
<dl class="box">
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
</dl>
|
62
|
+
<div class="clear"></div>
|
63
|
+
|
64
|
+
<h2>Defined Under Namespace</h2>
|
65
|
+
<p class="children">
|
66
|
+
|
67
|
+
|
68
|
+
<strong class="modules">Modules:</strong> <a href="EventMachine.html" title="EventMachine (module)">EventMachine</a>
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
</p>
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<div id="footer">
|
82
|
+
Generated on 08/21/10 01:02:12 by
|
83
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
|
84
|
+
0.5.8 (ruby-1.8.7).
|
85
|
+
</div>
|
86
|
+
|
87
|
+
</body>
|
88
|
+
</html>
|
data/lib/em-sofa.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
module EM::Sofa
|
2
|
+
module Mapping
|
3
|
+
# This method is automatically called when {Mapping} is included in a module.
|
4
|
+
# It automatically adds {InstanceMethods}, {ClassMethods}
|
5
|
+
# and initializes @mappings and @mappings_procs to empty Hashes.
|
6
|
+
#
|
7
|
+
# @param base [Module, Class] The module that this is included in
|
8
|
+
def self.included(base)
|
9
|
+
base.send(:include, InstanceMethods)
|
10
|
+
base.extend(ClassMethods)
|
11
|
+
base.instance_variable_set("@mappings", {})
|
12
|
+
base.instance_variable_set("@mappings_procs", {})
|
13
|
+
end
|
14
|
+
|
15
|
+
module InstanceMethods
|
16
|
+
# Returns hash of all the attributes, with attribute names as keys and attribute values as values.
|
17
|
+
#
|
18
|
+
# @return [Hash<Symbol, Object>] Hash of all attributes
|
19
|
+
# @see EM:Sofa::Mapping::ClassMethods#maps
|
20
|
+
def attributes
|
21
|
+
klass = self.class
|
22
|
+
klass.mappings.values.inject({}) do |attrs, to|
|
23
|
+
next unless to
|
24
|
+
attrs[to] = [:season_list, :episode_list].include?(to) ? method(to) : send(to)
|
25
|
+
attrs
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Updates all the attributes from the Hash.
|
30
|
+
#
|
31
|
+
# @param attributes [Hash<Symbol, Object>] A hash with attribute names as keys and attribute values as values
|
32
|
+
# @see EM:Sofa::Mapping::ClassMethods#maps
|
33
|
+
def update_with_mapping(attributes = {})
|
34
|
+
attributes.each do |key, value|
|
35
|
+
next unless (klass = self.class) and key.respond_to?(:to_sym) and to = klass.mappings[key.to_sym]
|
36
|
+
|
37
|
+
block = klass.mappings_procs[to]
|
38
|
+
value = block.call(value) if block
|
39
|
+
|
40
|
+
instance_variable_set("@#{to}", value)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Compares two objects based on their attributes.
|
45
|
+
#
|
46
|
+
# @param obj [Object] The object to compare with
|
47
|
+
# @return [Boolean] Whether all attributes are the same
|
48
|
+
def ==(obj)
|
49
|
+
if (klass = self.class) == obj.class
|
50
|
+
klass.mappings.inject(true) do |result, to_from|
|
51
|
+
to = to_from.last || to_from.first
|
52
|
+
result &&= (obj.send(to) == self.send(to))
|
53
|
+
end
|
54
|
+
else
|
55
|
+
super
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
module ClassMethods
|
61
|
+
# Class method to define mappings.
|
62
|
+
#
|
63
|
+
# @example Maps :examplename to :name and :link to itself.
|
64
|
+
# class Example1
|
65
|
+
# include EM:Sofa::Mapping
|
66
|
+
# maps(
|
67
|
+
# :examplename => :name,
|
68
|
+
# :link => nil
|
69
|
+
# )
|
70
|
+
# end
|
71
|
+
# example1 = Example1.new.update_with_mapping(:epnum => "1", :link => "http://google.com")
|
72
|
+
# example1.name # => "1"
|
73
|
+
# example1.link # => "http://google.com"
|
74
|
+
# example1.attributes # => {:name => "1", :link => "http://google.com"}
|
75
|
+
# @example Maps :airdate to :air_date and stores the block.
|
76
|
+
# class Example2
|
77
|
+
# include EM:Sofa::Mapping
|
78
|
+
#
|
79
|
+
# maps(:airdate => :air_date) do |value|
|
80
|
+
# Date.parse(value)
|
81
|
+
# end
|
82
|
+
# end
|
83
|
+
# example2 = Example2.new.update_with_mapping(:airdate => "2007-07-04")
|
84
|
+
# example2.attributes # => {:air_date => Wed, 04 Jul 2007}
|
85
|
+
def maps(hash = {}, &block)
|
86
|
+
hash.each do |from, to|
|
87
|
+
method = to || from
|
88
|
+
@mappings[from.to_sym] = method
|
89
|
+
attr_reader method
|
90
|
+
@mappings_procs[method] = block
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# @private
|
95
|
+
# @return [Hash<Symbol, Symbol>] Mapping of symbols to attribute names
|
96
|
+
def mappings
|
97
|
+
@mappings
|
98
|
+
end
|
99
|
+
|
100
|
+
# @private
|
101
|
+
# @return [Hash<Symbol, Proc>] Mapping of attribute names to a Proc filter.
|
102
|
+
# @see #maps
|
103
|
+
def mappings_procs
|
104
|
+
@mappings_procs
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#require 'em-http-request'
|
2
|
+
require 'crack'
|
3
|
+
|
4
|
+
module EM::Sofa
|
5
|
+
module TVRage
|
6
|
+
autoload :Schedule, 'em-sofa/tvrage/schedule'
|
7
|
+
autoload :Show, 'em-sofa/tvrage/show'
|
8
|
+
autoload :Season, 'em-sofa/tvrage/season'
|
9
|
+
autoload :Episode, 'em-sofa/tvrage/episode'
|
10
|
+
|
11
|
+
class HttpError < RuntimeError
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module EventMachine
|
2
|
+
module Sofa
|
3
|
+
module TVRage
|
4
|
+
# This class holds the XML information of a single episode as per the TVRage API.
|
5
|
+
#
|
6
|
+
# @see http://services.tvrage.com/index.php?page=public TVRage API : Episode List
|
7
|
+
class Episode
|
8
|
+
include Mapping
|
9
|
+
|
10
|
+
# @see EM:Sofa::Mapping
|
11
|
+
maps(
|
12
|
+
:epnum => :num,
|
13
|
+
:seasonnum => :num_in_season,
|
14
|
+
:prodnum => :prod_num,
|
15
|
+
:airdate => :air_date,
|
16
|
+
:link => nil,
|
17
|
+
:title => nil
|
18
|
+
)
|
19
|
+
|
20
|
+
# The season number of the Season this Episode belongs to.
|
21
|
+
# Not actually a part of the TVRage API, but it's used to inject
|
22
|
+
# the +season_num+ when looping through Episodes in a Season.
|
23
|
+
attr_reader :season_num
|
24
|
+
|
25
|
+
# Returns a new instance of Episode, mapping info from the TVRage API
|
26
|
+
#
|
27
|
+
# @param info [Hash<Symbol, Object>] Info to initialize with
|
28
|
+
# @option info [String] :epnum The episode number in the context of all episodes
|
29
|
+
# @option info [String] :seasonnum The episode number in the context of its season
|
30
|
+
# @option info [String] :prodnum
|
31
|
+
# @option info [String] :airdate The date the episode airs
|
32
|
+
# @option info [String] :link The TVRage page for this Episode
|
33
|
+
# @option info [String] :title The title of this Episode
|
34
|
+
# @option info [String] :season_num The season number of the Season this Episode belongs to
|
35
|
+
def initialize(info)
|
36
|
+
update_with_mapping(info)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|