em-sofa 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,17 @@
|
|
1
|
+
<pre>Show ID@6715
|
2
|
+
Show Name@The Colbert Report
|
3
|
+
Show URL@http://www.tvrage.com/The_Colbert_Report
|
4
|
+
Premiered@2005
|
5
|
+
Started@Oct/17/2005
|
6
|
+
Ended@
|
7
|
+
Latest Episode@05x146^Woody Harrelson^Nov/12/2009
|
8
|
+
Next Episode@05x147^Paul Goldberger^Nov/16/2009
|
9
|
+
RFC3339@2009-11-16T23:30:00-5:00
|
10
|
+
GMT+0 NODST@1258428600
|
11
|
+
Country@USA
|
12
|
+
Status@Returning Series
|
13
|
+
Classification@Talk Shows
|
14
|
+
Genres@Comedy
|
15
|
+
Network@Comedy Central
|
16
|
+
Airtime@Monday, Tuesday, Wednesday, Thursday at 11:30 pm
|
17
|
+
Runtime@30
|
@@ -0,0 +1 @@
|
|
1
|
+
No Show Results Were Found For "missing show"
|
@@ -0,0 +1,151 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Results>
|
3
|
+
<show>
|
4
|
+
<showid>15614</showid>
|
5
|
+
<name>Chuck</name>
|
6
|
+
<link>http://www.tvrage.com/Chuck</link>
|
7
|
+
<country>US</country>
|
8
|
+
<started>2007</started>
|
9
|
+
<ended>0</ended>
|
10
|
+
<seasons>3</seasons>
|
11
|
+
<status>Returning Series</status>
|
12
|
+
<classification>Scripted</classification>
|
13
|
+
<genres>
|
14
|
+
<genre01>Action</genre01>
|
15
|
+
<genre02>Comedy</genre02>
|
16
|
+
<genre03>Drama</genre03>
|
17
|
+
</genres>
|
18
|
+
</show>
|
19
|
+
<show>
|
20
|
+
<showid>11005</showid>
|
21
|
+
<name>The ChuckleHounds</name>
|
22
|
+
<link>http://www.tvrage.com/shows/id-11005</link>
|
23
|
+
<country>UK</country>
|
24
|
+
<started>1985</started>
|
25
|
+
<ended>1986</ended>
|
26
|
+
<seasons>1</seasons>
|
27
|
+
<status>Canceled/Ended</status>
|
28
|
+
<classification>Variety</classification>
|
29
|
+
<genres>
|
30
|
+
<genre01>Children</genre01>
|
31
|
+
</genres>
|
32
|
+
</show>
|
33
|
+
<show>
|
34
|
+
<showid>10223</showid>
|
35
|
+
<name>Chuck Norris: Karate Kommandos</name>
|
36
|
+
<link>http://www.tvrage.com/Chuck_Norris-Karate_Kommandos</link>
|
37
|
+
<country>US</country>
|
38
|
+
<started>1986</started>
|
39
|
+
<ended>1986</ended>
|
40
|
+
<seasons>1</seasons>
|
41
|
+
<status>Canceled/Ended</status>
|
42
|
+
<classification>Animation</classification>
|
43
|
+
<genres>
|
44
|
+
<genre01>Children Cartoons</genre01>
|
45
|
+
<genre02>Action</genre02>
|
46
|
+
<genre03>Adventure</genre03>
|
47
|
+
</genres>
|
48
|
+
</show>
|
49
|
+
<show>
|
50
|
+
<showid>919</showid>
|
51
|
+
<name>Chuck Finn</name>
|
52
|
+
<link>http://www.tvrage.com/shows/id-919</link>
|
53
|
+
<country>AU</country>
|
54
|
+
<started>1999</started>
|
55
|
+
<ended>2000</ended>
|
56
|
+
<seasons>2</seasons>
|
57
|
+
<status>Canceled/Ended</status>
|
58
|
+
<classification>Scripted</classification>
|
59
|
+
<genres>
|
60
|
+
<genre01>Adventure</genre01>
|
61
|
+
<genre02>Children</genre02>
|
62
|
+
<genre03>Fantasy</genre03>
|
63
|
+
</genres>
|
64
|
+
</show>
|
65
|
+
<show>
|
66
|
+
<showid>3063</showid>
|
67
|
+
<name>Chuck Woolery: Naturally Stoned</name>
|
68
|
+
<link>http://www.tvrage.com/shows/id-3063</link>
|
69
|
+
<country>US</country>
|
70
|
+
<started>2003</started>
|
71
|
+
<ended>2003</ended>
|
72
|
+
<seasons>1</seasons>
|
73
|
+
<status>Canceled/Ended</status>
|
74
|
+
<classification>Reality</classification>
|
75
|
+
<genres/>
|
76
|
+
</show>
|
77
|
+
<show>
|
78
|
+
<showid>1079</showid>
|
79
|
+
<name>The Chuck McCann Show</name>
|
80
|
+
<link>http://www.tvrage.com/shows/id-1079</link>
|
81
|
+
<country>US</country>
|
82
|
+
<started>1963</started>
|
83
|
+
<ended>1966</ended>
|
84
|
+
<seasons>0</seasons>
|
85
|
+
<status>Canceled/Ended</status>
|
86
|
+
<classification>0</classification>
|
87
|
+
<genres/>
|
88
|
+
</show>
|
89
|
+
<show>
|
90
|
+
<showid>10722</showid>
|
91
|
+
<name>Burns Chuckwagon From The Stampede Coral</name>
|
92
|
+
<link>http://www.tvrage.com/shows/id-10722</link>
|
93
|
+
<country>CA</country>
|
94
|
+
<started>1954</started>
|
95
|
+
<ended>1955</ended>
|
96
|
+
<seasons>0</seasons>
|
97
|
+
<status>Canceled/Ended</status>
|
98
|
+
<classification>Variety</classification>
|
99
|
+
<genres/>
|
100
|
+
</show>
|
101
|
+
<show>
|
102
|
+
<showid>19191</showid>
|
103
|
+
<name>The Chuck Barris Rah-Rah Show</name>
|
104
|
+
<link>http://www.tvrage.com/shows/id-19191</link>
|
105
|
+
<country>US</country>
|
106
|
+
<started>1978</started>
|
107
|
+
<ended>1978</ended>
|
108
|
+
<seasons>1</seasons>
|
109
|
+
<status>Canceled/Ended</status>
|
110
|
+
<classification>Variety</classification>
|
111
|
+
<genres>
|
112
|
+
<genre01>Celebrities</genre01>
|
113
|
+
<genre02>Comedy</genre02>
|
114
|
+
<genre03>Family</genre03>
|
115
|
+
<genre04>Music</genre04>
|
116
|
+
<genre05>Talent</genre05>
|
117
|
+
</genres>
|
118
|
+
</show>
|
119
|
+
<show>
|
120
|
+
<showid>14003</showid>
|
121
|
+
<name>Rinjin wa Hisoki Warau</name>
|
122
|
+
<link>http://www.tvrage.com/shows/id-14003</link>
|
123
|
+
<country>JP</country>
|
124
|
+
<started>1999</started>
|
125
|
+
<ended>1999</ended>
|
126
|
+
<seasons>1</seasons>
|
127
|
+
<status>Canceled/Ended</status>
|
128
|
+
<classification>Scripted</classification>
|
129
|
+
<genres>
|
130
|
+
<genre01>Crime</genre01>
|
131
|
+
<genre02>Drama</genre02>
|
132
|
+
<genre03>Mystery</genre03>
|
133
|
+
<genre04>Thriller</genre04>
|
134
|
+
</genres>
|
135
|
+
</show>
|
136
|
+
<show>
|
137
|
+
<showid>3062</showid>
|
138
|
+
<name>ChuckleVision</name>
|
139
|
+
<link>http://www.tvrage.com/shows/id-3062</link>
|
140
|
+
<country>UK</country>
|
141
|
+
<started>1987</started>
|
142
|
+
<ended>2008</ended>
|
143
|
+
<seasons>20</seasons>
|
144
|
+
<status>Canceled/Ended</status>
|
145
|
+
<classification>Scripted</classification>
|
146
|
+
<genres>
|
147
|
+
<genre01>Children</genre01>
|
148
|
+
<genre02>Comedy</genre02>
|
149
|
+
</genres>
|
150
|
+
</show>
|
151
|
+
</Results>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Showinfo>
|
3
|
+
<showid>2930</showid>
|
4
|
+
<showname>Buffy the Vampire Slayer</showname>
|
5
|
+
<showlink>http://tvrage.com/Buffy_The_Vampire_Slayer</showlink>
|
6
|
+
<seasons>7</seasons>
|
7
|
+
<started>1997</started>
|
8
|
+
<startdate>Mar/10/1997</startdate>
|
9
|
+
<ended>May/20/2003</ended>
|
10
|
+
<origin_country>US</origin_country>
|
11
|
+
<status>Canceled/Ended</status>
|
12
|
+
<classification>Scripted</classification>
|
13
|
+
<genres>
|
14
|
+
<genre>Action</genre>
|
15
|
+
<genre>Adventure</genre>
|
16
|
+
<genre>Comedy</genre>
|
17
|
+
<genre>Drama</genre>
|
18
|
+
<genre>Mystery</genre>
|
19
|
+
<genre>Sci-Fi</genre>
|
20
|
+
</genres>
|
21
|
+
<runtime>60</runtime>
|
22
|
+
<network country="US">UPN</network>
|
23
|
+
<airtime>20:00</airtime>
|
24
|
+
<airday>Tuesday</airday>
|
25
|
+
<timezone>GMT-5 -DST</timezone>
|
26
|
+
<akas>
|
27
|
+
<aka country="SE">Buffy & vampyrerna</aka>
|
28
|
+
<aka country="DE">Buffy - Im Bann der Dämonen</aka>
|
29
|
+
<aka country="NO">Buffy - Vampyrenes skrekk</aka>
|
30
|
+
<aka country="HU">Buffy a vámpírok réme</aka>
|
31
|
+
<aka country="FR">Buffy Contre les Vampires</aka>
|
32
|
+
<aka country="IT">Buffy l'Ammazza Vampiri</aka>
|
33
|
+
<aka country="PL">Buffy postrach wampirów</aka>
|
34
|
+
<aka country="BR">Buffy, a Caça-Vampiros</aka>
|
35
|
+
<aka country="PT">Buffy, a Caçadora de Vampiros</aka>
|
36
|
+
<aka country="ES">Buffy, Cazavampiros</aka>
|
37
|
+
<aka country="HR">Buffy, ubojica vampira</aka>
|
38
|
+
<aka country="FI">Buffy, vampyyrintappaja</aka>
|
39
|
+
<aka country="EE">Vampiiritapja Buffy</aka>
|
40
|
+
<aka country="IS">Vampírubaninn Buffy</aka>
|
41
|
+
</akas>
|
42
|
+
</Showinfo>
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require './spec_helper'
|
2
|
+
|
3
|
+
describe "Mapped Object" do
|
4
|
+
before do
|
5
|
+
class MappedObject
|
6
|
+
include EventMachine::Sofa::Mapping
|
7
|
+
|
8
|
+
maps(:a => nil)
|
9
|
+
maps(:B => :b)
|
10
|
+
maps(:c => nil) do |c|
|
11
|
+
c * 2
|
12
|
+
end
|
13
|
+
end
|
14
|
+
@obj = MappedObject.new
|
15
|
+
@value = mock()
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should respond to #a" do
|
19
|
+
@obj.should respond_to(:a)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should respond to #b" do
|
23
|
+
@obj.should respond_to(:b)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should update @a" do
|
27
|
+
@obj.update_with_mapping(:a => @value)
|
28
|
+
@obj.a.should == @value
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should update @b" do
|
32
|
+
@obj.update_with_mapping(:B => @value)
|
33
|
+
@obj.b.should == @value
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should update @c" do
|
37
|
+
@obj.update_with_mapping(:c => 1)
|
38
|
+
@obj.c.should == 2
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should not update @d" do
|
42
|
+
@obj.update_with_mapping(:d => @value)
|
43
|
+
@obj.instance_variable_get("@").should_not == @value
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should not update keys that don't respond to :to_sym" do
|
47
|
+
lambda {
|
48
|
+
@obj.update_with_mapping(mock() => @value)
|
49
|
+
}.should_not raise_error
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should get attributes as keys and their values as values" do
|
53
|
+
a, b = mock, mock
|
54
|
+
@obj.update_with_mapping(:a => a, :B => b)
|
55
|
+
@obj.attributes.should == {:a => a, :b => b, :c => nil}
|
56
|
+
end
|
57
|
+
|
58
|
+
context "and another Mapped Object" do
|
59
|
+
before do
|
60
|
+
@other = MappedObject.new
|
61
|
+
@obj.update_with_mapping(:a => @value)
|
62
|
+
@other.update_with_mapping(:a => @value)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should be #eql" do
|
66
|
+
@obj.should == @other
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should not be #equal" do
|
70
|
+
@obj.should_not equal(@other)
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should not be #eql with different params" do
|
74
|
+
@other.update_with_mapping(:B => mock())
|
75
|
+
@obj.should_not == @other
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should not be #eql to different class" do
|
79
|
+
@obj.should_not == mock()
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require './spec_helper'
|
2
|
+
|
3
|
+
if ENV["CASES"]
|
4
|
+
|
5
|
+
describe "Cases" do
|
6
|
+
Dir["spec/fixtures/tvrage/cases/*.xml"].each do |file|
|
7
|
+
describe "with #{file}" do
|
8
|
+
before do
|
9
|
+
@id = "22323"
|
10
|
+
@show_xml = File.read(file)
|
11
|
+
FakeWeb.register_uri(:get, "http://services.tvrage.com/feeds/full_show_info.php?sid=#{@id}", :body => @show_xml)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should not raise error" do
|
15
|
+
lambda {
|
16
|
+
show = Sofa::TVRage::Show.new(@id, :greedy => true)
|
17
|
+
show.episode_list.should_not include(nil)
|
18
|
+
}.should_not raise_error
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should have name" do
|
22
|
+
show = Sofa::TVRage::Show.new(@id, :greedy => true)
|
23
|
+
show.name.should_not be_nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require './spec_helper'
|
2
|
+
|
3
|
+
module EventMachine::Sofa::TVRage
|
4
|
+
|
5
|
+
describe Episode do
|
6
|
+
before do
|
7
|
+
@info = Crack::XML.parse(File.read("spec/fixtures/tvrage/single_episode.xml"))["episode"]
|
8
|
+
end
|
9
|
+
|
10
|
+
subject { Episode.new(@info) }
|
11
|
+
|
12
|
+
{ :num => "1",
|
13
|
+
:num_in_season => "01",
|
14
|
+
:prod_num => "4V01",
|
15
|
+
:air_date => "1997-03-10",
|
16
|
+
:link => "http://www.tvrage.com/Buffy_The_Vampire_Slayer/episodes/28077",
|
17
|
+
:title => "Welcome to the Hellmouth (1)"
|
18
|
+
}.each do |attr, value|
|
19
|
+
it "should get ##{attr}" do
|
20
|
+
subject.send(attr).should == value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should have season number" do
|
25
|
+
subject.should respond_to(:season_num)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should be #eql to episode with same attributes" do
|
29
|
+
other = Episode.new(@info)
|
30
|
+
subject.should == other
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should not be #eql to episode with different attributes" do
|
34
|
+
other = Episode.new(@info.merge("epnum" => "4"))
|
35
|
+
subject.num.should_not == other.num
|
36
|
+
subject.should_not == other
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should not be #equal to episode with same attributes" do
|
40
|
+
other = Episode.new(@info)
|
41
|
+
subject.should_not equal(other)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require './spec_helper'
|
2
|
+
|
3
|
+
module EventMachine::Sofa::TVRage
|
4
|
+
|
5
|
+
describe Schedule do
|
6
|
+
before do
|
7
|
+
@country = "US"
|
8
|
+
@xml = File.read("spec/fixtures/tvrage/full_schedule.xml")
|
9
|
+
FakeWeb.register_uri(:get, "http://services.tvrage.com/feeds/fullschedule.php?country=#{@country}", :body => @xml)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should get full US schedule" do
|
13
|
+
Schedule.full(@country).should == Crack::XML.parse(@xml)["schedule"]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require './spec_helper'
|
2
|
+
|
3
|
+
module EventMachine::Sofa::TVRage
|
4
|
+
|
5
|
+
describe Season do
|
6
|
+
describe "with 1 episode" do
|
7
|
+
before do
|
8
|
+
@info = Crack::XML.parse(File.read("spec/fixtures/tvrage/episode_list_one_season.xml"))["Show"]["Episodelist"]["Season"]
|
9
|
+
@episodes = [Episode.new(@info["episode"])]
|
10
|
+
end
|
11
|
+
|
12
|
+
subject { Season.new(@info) }
|
13
|
+
|
14
|
+
it "should have #no" do
|
15
|
+
subject.no.should == "0"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have episode" do
|
19
|
+
subject.episodes.should == @episodes
|
20
|
+
subject.episodes.size.should == 1
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be #eql to season with same attributes" do
|
24
|
+
other = Season.new(@info)
|
25
|
+
subject.should == other
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should not be #eql to season with different attributes" do
|
29
|
+
other = Season.new(@info.merge("no" => "23"))
|
30
|
+
subject.should_not == other
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should not be #equal to season with same attributes" do
|
34
|
+
other = Season.new(@info)
|
35
|
+
subject.should_not equal(other)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "with 2 episodes" do
|
40
|
+
before do
|
41
|
+
@info = Crack::XML.parse(File.read("spec/fixtures/tvrage/episode_list_two_episodes.xml"))["Show"]["Episodelist"]["Season"]
|
42
|
+
@episodes = []
|
43
|
+
@info["episode"].each do |episode|
|
44
|
+
@episodes << Episode.new(episode)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
subject { Season.new(@info) }
|
49
|
+
|
50
|
+
it "should have #no" do
|
51
|
+
subject.no.should == "1"
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should have episodes" do
|
55
|
+
subject.episodes.should == @episodes
|
56
|
+
subject.episodes.size.should == 2
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|