thetvdb_mapper 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/thetvdb_mapper/actors.rb +5 -1
- data/lib/thetvdb_mapper/banners.rb +5 -1
- data/lib/thetvdb_mapper/episode.rb +5 -1
- data/lib/thetvdb_mapper/full_series.rb +20 -4
- data/lib/thetvdb_mapper/mapping/actor.rb +1 -1
- data/lib/thetvdb_mapper/mapping/banner.rb +1 -1
- data/lib/thetvdb_mapper/mapping/base.rb +17 -7
- data/lib/thetvdb_mapper/mapping/episode.rb +2 -2
- data/lib/thetvdb_mapper/mapping/series.rb +2 -2
- data/lib/thetvdb_mapper/mapping/string_list.rb +2 -2
- data/lib/thetvdb_mapper/series.rb +5 -1
- data/lib/thetvdb_mapper/version.rb +1 -1
- data/spec/functionals/mapping/actor_spec.rb +13 -8
- data/spec/functionals/mapping/banner_spec.rb +26 -14
- data/spec/functionals/mapping/episode_spec.rb +62 -32
- data/spec/functionals/mapping/series_spec.rb +48 -25
- data/spec/integrations/classes/episode_spec.rb +0 -1
- data/spec/units/actors_spec.rb +8 -1
- data/spec/units/banners_spec.rb +8 -1
- data/spec/units/episode_spec.rb +8 -1
- data/spec/units/full_series_spec.rb +35 -4
- data/spec/units/mapping/actor_spec.rb +6 -6
- data/spec/units/mapping/banner_spec.rb +13 -13
- data/spec/units/mapping/base_spec.rb +17 -10
- data/spec/units/mapping/episode_spec.rb +34 -33
- data/spec/units/mapping/series_spec.rb +27 -26
- data/spec/units/mapping/string_list_spec.rb +2 -2
- data/spec/units/series_spec.rb +8 -1
- metadata +2 -2
@@ -1,141 +1,142 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ThetvdbMapper::Mapping::Episode do
|
4
|
-
let(:
|
4
|
+
let(:model) { ThetvdbMapper::Mapping::Episode.new({}) }
|
5
5
|
|
6
6
|
describe '#map' do
|
7
7
|
it 'should map id' do
|
8
|
-
|
8
|
+
model.rules['id'].should == :id
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'should map Combined_episodenumber' do
|
12
|
-
|
12
|
+
model.rules['Combined_episodenumber'].should == :combined_episode_number
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should map Combined_season' do
|
16
|
-
|
16
|
+
model.rules['Combined_season'].should == :combined_season
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should map DVD_episodenumber' do
|
20
|
-
|
20
|
+
model.rules['DVD_episodenumber'].should == :dvd_episode_number
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should map DVD_season' do
|
24
|
-
|
24
|
+
model.rules['DVD_season'].should == :dvd_season
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should map Director' do
|
28
|
-
|
28
|
+
model.rules['Director'].should == :director
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should map EpImgFlag' do
|
32
|
-
|
32
|
+
model.rules['EpImgFlag'].should == :ep_img_flag
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'should map EpisodeName' do
|
36
|
-
|
36
|
+
model.rules['EpisodeName'].should == :name
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'should map EpisodeNumber' do
|
40
|
-
|
40
|
+
model.rules['EpisodeNumber'].should == :number
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'should map FirstAired' do
|
44
|
-
|
44
|
+
model.rules['FirstAired'].should == :first_aired
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'should map GuestStars' do
|
48
|
-
|
48
|
+
model.rules['GuestStars'].should == :guest_stars
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'should map IMDB_ID' do
|
52
|
-
|
52
|
+
model.rules['IMDB_ID'].should == :imdb_id
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should map Language' do
|
56
|
-
|
56
|
+
model.rules['Language'].should == :language
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'should map Overview' do
|
60
|
-
|
60
|
+
model.rules['Overview'].should == :overview
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'should map ProductionCode' do
|
64
|
-
|
64
|
+
model.rules['ProductionCode'].should == :production_code
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'should map Rating' do
|
68
|
-
|
68
|
+
model.rules['Rating'].should == :rating
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'should map RatingCount' do
|
72
|
-
|
72
|
+
model.rules['RatingCount'].should == :rating_count
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'should map SeasonNumber' do
|
76
|
-
|
76
|
+
model.rules['SeasonNumber'].should == :season
|
77
77
|
end
|
78
78
|
|
79
79
|
it 'should map Writer' do
|
80
|
-
|
80
|
+
model.rules['Writer'].should == :writer
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'should map absolute_number' do
|
84
|
-
|
84
|
+
model.rules['absolute_number'].should == :absolute_number
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'should map airsafter_season' do
|
88
|
-
|
88
|
+
model.rules['airsafter_season'].should == :airs_after_season
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'should map airsbefore_episode' do
|
92
|
-
|
92
|
+
model.rules['airsbefore_episode'].should == :airs_before_episode
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'should map airsbefore_season' do
|
96
|
-
|
96
|
+
model.rules['airsbefore_season'].should == :airs_before_season
|
97
97
|
end
|
98
98
|
|
99
99
|
it 'should map filename' do
|
100
|
-
|
100
|
+
model.rules['filename'].should == :filename_path
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'should map lastupdated' do
|
104
|
-
|
104
|
+
model.rules['lastupdated'].should == :last_updated_at
|
105
105
|
end
|
106
106
|
|
107
107
|
it 'should map seasonid' do
|
108
|
-
|
108
|
+
model.rules['seasonid'].should == :season_id
|
109
109
|
end
|
110
110
|
|
111
111
|
it 'should map seriesid' do
|
112
|
-
|
112
|
+
model.rules['seriesid'].should == :series_id
|
113
113
|
end
|
114
114
|
|
115
115
|
it 'should map thumb_added' do
|
116
|
-
|
116
|
+
model.rules['thumb_added'].should == :thumbnail_added_at
|
117
117
|
end
|
118
118
|
|
119
119
|
it 'should map thumb_height' do
|
120
|
-
|
120
|
+
model.rules['thumb_height'].should == :thumbnail_height
|
121
121
|
end
|
122
122
|
|
123
123
|
it 'should map thumb_width' do
|
124
|
-
|
124
|
+
model.rules['thumb_width'].should == :thumbnail_width
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
128
|
describe '#convert' do
|
129
129
|
let(:input) { { director: true, guest_stars: true, writer: true, last_updated_at: 1} }
|
130
130
|
let(:output) { { director: 'LIST', guest_stars: 'LIST', writer: 'LIST', last_updated_at: 'TIME'} }
|
131
|
+
let(:model) { ThetvdbMapper::Mapping::Episode.new(input) }
|
131
132
|
|
132
133
|
before do
|
133
|
-
|
134
|
+
model.stub(:convert_to_list).and_return('LIST')
|
134
135
|
Time.stub(:at).and_return('TIME')
|
135
136
|
end
|
136
137
|
|
137
138
|
it 'should return correct hash' do
|
138
|
-
|
139
|
+
model.convert.should == output
|
139
140
|
end
|
140
141
|
end
|
141
142
|
end
|
@@ -1,113 +1,114 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ThetvdbMapper::Mapping::Series do
|
4
|
-
let(:
|
4
|
+
let(:model) { ThetvdbMapper::Mapping::Series.new({}) }
|
5
5
|
|
6
6
|
describe '#rules' do
|
7
7
|
it 'should map id' do
|
8
|
-
|
8
|
+
model.rules['id'].should == :id
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'should map Airs_DayOfWeek' do
|
12
|
-
|
12
|
+
model.rules['Airs_DayOfWeek'].should == :airs_day_of_week
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should map Airs_Time' do
|
16
|
-
|
16
|
+
model.rules['Airs_Time'].should == :airs_time
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should map ContentRating' do
|
20
|
-
|
20
|
+
model.rules['ContentRating'].should == :content_rating
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should map FirstAired' do
|
24
|
-
|
24
|
+
model.rules['FirstAired'].should == :first_aired
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should map Genre' do
|
28
|
-
|
28
|
+
model.rules['Genre'].should == :genres
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should map IMDB_ID' do
|
32
|
-
|
32
|
+
model.rules['IMDB_ID'].should == :imdb_id
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'should map Language' do
|
36
|
-
|
36
|
+
model.rules['Language'].should == :language
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'should map Network' do
|
40
|
-
|
40
|
+
model.rules['Network'].should == :network
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'should map NetworkID' do
|
44
|
-
|
44
|
+
model.rules['NetworkID'].should == :network_id
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'should map Overview' do
|
48
|
-
|
48
|
+
model.rules['Overview'].should == :overview
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'should map Rating' do
|
52
|
-
|
52
|
+
model.rules['Rating'].should == :rating
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should map RatingCount' do
|
56
|
-
|
56
|
+
model.rules['RatingCount'].should == :rating_count
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'should map Runtime' do
|
60
|
-
|
60
|
+
model.rules['Runtime'].should == :runtime
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'should map SeriesName' do
|
64
|
-
|
64
|
+
model.rules['SeriesName'].should == :name
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'should map Status' do
|
68
|
-
|
68
|
+
model.rules['Status'].should == :status
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'should map added' do
|
72
|
-
|
72
|
+
model.rules['added'].should == :added_at
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'should map addedBy' do
|
76
|
-
|
76
|
+
model.rules['addedBy'].should == :added_by
|
77
77
|
end
|
78
78
|
|
79
79
|
it 'should map banner' do
|
80
|
-
|
80
|
+
model.rules['banner'].should == :banner_path
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'should map fanart' do
|
84
|
-
|
84
|
+
model.rules['fanart'].should == :fanart_path
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'should map lastupdated' do
|
88
|
-
|
88
|
+
model.rules['lastupdated'].should == :last_updated_at
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'should map poster' do
|
92
|
-
|
92
|
+
model.rules['poster'].should == :poster_path
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'should map zap2it_id' do
|
96
|
-
|
96
|
+
model.rules['zap2it_id'].should == :zap2it_id
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
100
|
describe '#convert' do
|
101
101
|
let(:input) { { genres: true, last_updated_at: 1} }
|
102
102
|
let(:output) { { genres: 'LIST', last_updated_at: 'TIME'} }
|
103
|
+
let(:model) { ThetvdbMapper::Mapping::Series.new(input) }
|
103
104
|
|
104
105
|
before do
|
105
|
-
|
106
|
+
model.stub(:convert_to_list).and_return('LIST')
|
106
107
|
Time.stub(:at).and_return('TIME')
|
107
108
|
end
|
108
109
|
|
109
110
|
it 'should return correct hash' do
|
110
|
-
|
111
|
+
model.convert.should == output
|
111
112
|
end
|
112
113
|
end
|
113
114
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ThetvdbMapper::Mapping::StringList do
|
4
|
-
let(:
|
4
|
+
let(:model) { ThetvdbMapper::Mapping::StringList.new('|test|') }
|
5
5
|
|
6
6
|
describe '#map' do
|
7
7
|
it 'should return array' do
|
8
|
-
|
8
|
+
model.map.should == ['test']
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/spec/units/series_spec.rb
CHANGED
@@ -9,7 +9,8 @@ describe ThetvdbMapper::Series do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'should call map on mapping class' do
|
12
|
-
|
12
|
+
model.stub(:mapping_object).and_return(double(map: true))
|
13
|
+
model.mapping_object(sample: true).should_receive(:map)
|
13
14
|
model.data
|
14
15
|
end
|
15
16
|
end
|
@@ -23,4 +24,10 @@ describe ThetvdbMapper::Series do
|
|
23
24
|
model.inspect.should == '<ThetvdbMapper::Series data=DATA >'
|
24
25
|
end
|
25
26
|
end
|
27
|
+
|
28
|
+
describe '.mapping_object' do
|
29
|
+
it 'should return mapping episode instance' do
|
30
|
+
model.mapping_object(sample: true).class.should == ThetvdbMapper::Mapping::Series
|
31
|
+
end
|
32
|
+
end
|
26
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thetvdb_mapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Wawer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thetvdb_api
|