thetvdb_mapper 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bae6417686751f5c3906eb98c0b4311a289052e9
4
- data.tar.gz: e0e998f6b6aa9e5110dede2c4b7d54facc99db3c
3
+ metadata.gz: ebe37c00f3c228440174f44a7116b34e511c15c5
4
+ data.tar.gz: f28788316945638ff5788bc7ab177fad360a99d6
5
5
  SHA512:
6
- metadata.gz: 74ccff6592d49df1951b7f91d2b91415bef7e542b51c077d315318e76adb961cc8829770cb26f0fba48b76bc5e80d9c7b5e8efaf2399866e799f7352c64dddc3
7
- data.tar.gz: 9fd673575408786af948eb74153d97571217907c67d74af82b11fd4b3b123e423a2b385c633969b3cf35b9268e2f4a50eb634079d99c7f1b44bc61a9da7dc48a
6
+ metadata.gz: be570ebd08931b688b006150aaa88080ce7ff57bcf74c5bb0da7b6c4b0ebc48ed1d4ed017af73b57535dba5887f5c705b523b97c155bbedf5b4ade87afdaf85a
7
+ data.tar.gz: c0decaf79aa02a7657cffc7b58565af84a0254d2b15f9aa7873c7b763327ddbdddf29d9c4668d927c05cd3766d0377465a209241b210cf7dabda03c5ccee0383
@@ -1,6 +1,7 @@
1
1
  class ThetvdbMapper::Mapping::Banner < ThetvdbMapper::Mapping::Base
2
2
  def self.rules
3
3
  {
4
+ 'id' => :id,
4
5
  'BannerPath' => :path,
5
6
  'ThumbnailPath' => :thumbnail_path,
6
7
  'VignettePath' => :vignette_path,
@@ -8,7 +8,7 @@ class ThetvdbMapper::Mapping::Base
8
8
  data = convert(data)
9
9
  end
10
10
 
11
- data
11
+ data.reject{ |key, _| key.is_a?(String) }
12
12
  end
13
13
 
14
14
  def self.convert_to_list(data)
@@ -26,11 +26,11 @@ class ThetvdbMapper::Mapping::Episode < ThetvdbMapper::Mapping::Base
26
26
  'airsbefore_season' => :airs_before_season,
27
27
  'filename' => :filename_path,
28
28
  'lastupdated' => :last_updated_at,
29
- 'season_id' => :season_id,
30
- 'series_id' => :series_id,
29
+ 'seasonid' => :season_id,
30
+ 'seriesid' => :series_id,
31
31
  'thumb_added' => :thumbnail_added_at,
32
32
  'thumb_height' => :thumbnail_height,
33
- 'thumb_weight' => :thumbnail_width
33
+ 'thumb_width' => :thumbnail_width
34
34
  }
35
35
  end
36
36
 
@@ -6,7 +6,7 @@ class ThetvdbMapper::Mapping::Series < ThetvdbMapper::Mapping::Base
6
6
  'Airs_Time' => :airs_time,
7
7
  'ContentRating' => :content_rating,
8
8
  'FirstAired' => :first_aired,
9
- 'genre' => :genres,
9
+ 'Genre' => :genres,
10
10
  'IMDB_ID' => :imdb_id,
11
11
  'Language' => :language,
12
12
  'Network' => :network,
@@ -18,7 +18,7 @@ class ThetvdbMapper::Mapping::Series < ThetvdbMapper::Mapping::Base
18
18
  'SeriesName' => :name,
19
19
  'Status' => :status,
20
20
  'added' => :added_at,
21
- 'added_by' => :added_by,
21
+ 'addedBy' => :added_by,
22
22
  'banner' => :banner_path,
23
23
  'fanart' => :fanart_path,
24
24
  'lastupdated' => :last_updated_at,
@@ -1,3 +1,3 @@
1
1
  module ThetvdbMapper
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -6,7 +6,11 @@ describe ThetvdbMapper::Mapping::Banner do
6
6
  describe '#map' do
7
7
  it 'should return specific keys' do
8
8
  klass.map({}).keys.sort.should == [:path, :thumbnail_path, :vignette_path, :type, :type2, :language, :season,
9
- :rating, :rating_count, :series_name, :colors].sort
9
+ :rating, :rating_count, :series_name, :colors, :id].sort
10
+ end
11
+
12
+ it 'should map id' do
13
+ klass.map('id' => '1')[:id].should == '1'
10
14
  end
11
15
 
12
16
  it 'should map BannerPath' do
@@ -112,12 +112,12 @@ describe ThetvdbMapper::Mapping::Episode do
112
112
  klass.map('lastupdated' => '1234')[:last_updated_at].should == Time.at(1234)
113
113
  end
114
114
 
115
- it 'should map season_id' do
116
- klass.map('season_id' => '1')[:season_id].should == '1'
115
+ it 'should map seasonid' do
116
+ klass.map('seasonid' => '1')[:season_id].should == '1'
117
117
  end
118
118
 
119
- it 'should map series_id' do
120
- klass.map('series_id' => '1')[:series_id].should == '1'
119
+ it 'should map seriesid' do
120
+ klass.map('seriesid' => '1')[:series_id].should == '1'
121
121
  end
122
122
 
123
123
  it 'should map thumb_added' do
@@ -128,8 +128,8 @@ describe ThetvdbMapper::Mapping::Episode do
128
128
  klass.map('thumb_height' => 'test')[:thumbnail_height].should == 'test'
129
129
  end
130
130
 
131
- it 'should map thumb_weight' do
132
- klass.map('thumb_weight' => 'test')[:thumbnail_width].should == 'test'
131
+ it 'should map thumb_width' do
132
+ klass.map('thumb_width' => 'test')[:thumbnail_width].should == 'test'
133
133
  end
134
134
  end
135
135
  end
@@ -30,8 +30,8 @@ describe ThetvdbMapper::Mapping::Series do
30
30
  klass.map('FirstAired' => '1997-07-01')[:first_aired].should == '1997-07-01'
31
31
  end
32
32
 
33
- it 'should map genre' do
34
- klass.map('genre' => '|comedy|')[:genres].should == ['comedy']
33
+ it 'should map Genre' do
34
+ klass.map('Genre' => '|comedy|')[:genres].should == ['comedy']
35
35
  end
36
36
 
37
37
  it 'should map IMDB_ID' do
@@ -78,8 +78,8 @@ describe ThetvdbMapper::Mapping::Series do
78
78
  klass.map('added' => '1')[:added_at].should == '1'
79
79
  end
80
80
 
81
- it 'should map added_by' do
82
- klass.map('added_by' => '1')[:added_by].should == '1'
81
+ it 'should map addedBy' do
82
+ klass.map('addedBy' => '1')[:added_by].should == '1'
83
83
  end
84
84
 
85
85
  it 'should map banner' do
@@ -5,6 +5,7 @@ describe ThetvdbMapper::Episode do
5
5
 
6
6
  describe '.data' do
7
7
  it 'should return array' do
8
+ puts model.data.inspect
8
9
  model.data.class.should == Hash
9
10
  end
10
11
  end
@@ -4,6 +4,9 @@ describe ThetvdbMapper::Mapping::Banner do
4
4
  let(:klass) { ThetvdbMapper::Mapping::Banner }
5
5
 
6
6
  describe '#rules' do
7
+ it 'should map id' do
8
+ klass.rules['id'].should == :id
9
+ end
7
10
  it 'should map BannerPath' do
8
11
  klass.rules['BannerPath'].should == :path
9
12
  end
@@ -15,7 +15,7 @@ describe ThetvdbMapper::Mapping::Banner do
15
15
 
16
16
  it 'should call convert method if exists' do
17
17
  klass.stub(:respond_to?).with(:convert).and_return(true)
18
- klass.should_receive(:convert)
18
+ klass.should_receive(:convert).and_return({})
19
19
  klass.map(sample: 'test')
20
20
  end
21
21
  end
@@ -104,12 +104,12 @@ describe ThetvdbMapper::Mapping::Episode do
104
104
  klass.rules['lastupdated'].should == :last_updated_at
105
105
  end
106
106
 
107
- it 'should map season_id' do
108
- klass.rules['season_id'].should == :season_id
107
+ it 'should map seasonid' do
108
+ klass.rules['seasonid'].should == :season_id
109
109
  end
110
110
 
111
- it 'should map series_id' do
112
- klass.rules['series_id'].should == :series_id
111
+ it 'should map seriesid' do
112
+ klass.rules['seriesid'].should == :series_id
113
113
  end
114
114
 
115
115
  it 'should map thumb_added' do
@@ -120,8 +120,8 @@ describe ThetvdbMapper::Mapping::Episode do
120
120
  klass.rules['thumb_height'].should == :thumbnail_height
121
121
  end
122
122
 
123
- it 'should map thumb_weight' do
124
- klass.rules['thumb_weight'].should == :thumbnail_width
123
+ it 'should map thumb_width' do
124
+ klass.rules['thumb_width'].should == :thumbnail_width
125
125
  end
126
126
  end
127
127
 
@@ -24,8 +24,8 @@ describe ThetvdbMapper::Mapping::Series do
24
24
  klass.rules['FirstAired'].should == :first_aired
25
25
  end
26
26
 
27
- it 'should map genre' do
28
- klass.rules['genre'].should == :genres
27
+ it 'should map Genre' do
28
+ klass.rules['Genre'].should == :genres
29
29
  end
30
30
 
31
31
  it 'should map IMDB_ID' do
@@ -72,8 +72,8 @@ describe ThetvdbMapper::Mapping::Series do
72
72
  klass.rules['added'].should == :added_at
73
73
  end
74
74
 
75
- it 'should map added_by' do
76
- klass.rules['added_by'].should == :added_by
75
+ it 'should map addedBy' do
76
+ klass.rules['addedBy'].should == :added_by
77
77
  end
78
78
 
79
79
  it 'should map banner' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thetvdb_mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Wawer