thetvdb_mapper 0.0.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.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.travis.yml +6 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +41 -0
  7. data/Rakefile +1 -0
  8. data/lib/thetvdb_mapper/actors.rb +13 -0
  9. data/lib/thetvdb_mapper/banners.rb +13 -0
  10. data/lib/thetvdb_mapper/base.rb +11 -0
  11. data/lib/thetvdb_mapper/episode.rb +9 -0
  12. data/lib/thetvdb_mapper/fetcher.rb +25 -0
  13. data/lib/thetvdb_mapper/full_series.rb +37 -0
  14. data/lib/thetvdb_mapper/mapping/actor.rb +11 -0
  15. data/lib/thetvdb_mapper/mapping/banner.rb +17 -0
  16. data/lib/thetvdb_mapper/mapping/base.rb +17 -0
  17. data/lib/thetvdb_mapper/mapping/episode.rb +45 -0
  18. data/lib/thetvdb_mapper/mapping/series.rb +36 -0
  19. data/lib/thetvdb_mapper/mapping/string_list.rb +5 -0
  20. data/lib/thetvdb_mapper/series.rb +9 -0
  21. data/lib/thetvdb_mapper/version.rb +3 -0
  22. data/lib/thetvdb_mapper.rb +18 -0
  23. data/spec/functionals/mapping/actor_spec.rb +31 -0
  24. data/spec/functionals/mapping/banner_spec.rb +56 -0
  25. data/spec/functionals/mapping/episode_spec.rb +135 -0
  26. data/spec/functionals/mapping/series_spec.rb +105 -0
  27. data/spec/integrations/classes/actors_spec.rb +11 -0
  28. data/spec/integrations/classes/banners_spec.rb +11 -0
  29. data/spec/integrations/classes/episode_spec.rb +11 -0
  30. data/spec/integrations/classes/fetcher_spec.rb +35 -0
  31. data/spec/integrations/classes/full_series_spec.rb +11 -0
  32. data/spec/integrations/classes/series_spec.rb +11 -0
  33. data/spec/integrations/integration_spec_helper.rb +2 -0
  34. data/spec/integrations/support/.keep +0 -0
  35. data/spec/spec_helper.rb +10 -0
  36. data/spec/units/actors_spec.rb +33 -0
  37. data/spec/units/banners_spec.rb +33 -0
  38. data/spec/units/base_spec.rb +15 -0
  39. data/spec/units/episode_spec.rb +26 -0
  40. data/spec/units/fetcher_spec.rb +67 -0
  41. data/spec/units/full_series_spec.rb +109 -0
  42. data/spec/units/mapping/actor_spec.rb +27 -0
  43. data/spec/units/mapping/banner_spec.rb +51 -0
  44. data/spec/units/mapping/base_spec.rb +29 -0
  45. data/spec/units/mapping/episode_spec.rb +141 -0
  46. data/spec/units/mapping/series_spec.rb +113 -0
  47. data/spec/units/mapping/string_list_spec.rb +11 -0
  48. data/spec/units/series_spec.rb +26 -0
  49. data/thetvdb_mapper.gemspec +27 -0
  50. metadata +188 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bae6417686751f5c3906eb98c0b4311a289052e9
4
+ data.tar.gz: e0e998f6b6aa9e5110dede2c4b7d54facc99db3c
5
+ SHA512:
6
+ metadata.gz: 74ccff6592d49df1951b7f91d2b91415bef7e542b51c077d315318e76adb961cc8829770cb26f0fba48b76bc5e80d9c7b5e8efaf2399866e799f7352c64dddc3
7
+ data.tar.gz: 9fd673575408786af948eb74153d97571217907c67d74af82b11fd4b3b123e423a2b385c633969b3cf35b9268e2f4a50eb634079d99c7f1b44bc61a9da7dc48a
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+
19
+ spec/integrations/support/thetvdb_api.rb
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ script: 'bundle exec rspec spec/units && bundle exec rspec spec/functionals && bundle exec rspec spec/units'
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in thetvdb_mapper.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Krzysztof Wawer
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ [![Build Status](https://travis-ci.org/wafcio/thetvdb_mapper.png?branch=master)](https://travis-ci.org/wafcio/thetvdb_mapper)
2
+ [![Dependency Status](https://gemnasium.com/wafcio/thetvdb_mapper.png)](https://gemnasium.com/wafcio/thetvdb_mapper)
3
+ [![Code Climate](https://codeclimate.com/github/wafcio/thetvdb_mapper.png)](https://codeclimate.com/github/wafcio/thetvdb_mapper)
4
+ [![Coverage Status](https://coveralls.io/repos/wafcio/thetvdb_mapper/badge.png)](https://coveralls.io/r/wafcio/thetvdb_mapper)
5
+ [![Gem Version](https://badge.fury.io/rb/thetvdb_mapper.png)](http://badge.fury.io/rb/thetvdb_mapper)
6
+
7
+ # ThetvdbMapper
8
+
9
+ Fetch data from thetvdb.com and mapping to common hash, where keys are symbols and underline.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ gem 'thetvdb_mapper'
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install thetvdb_mapper
24
+
25
+ ## Usage
26
+
27
+ ```ruby
28
+ ThetvdbMapper::Actor.new(series_id).data # return actors
29
+ ThetvdbMapper::Banners.new(series_id).data # return banners hash (not image)
30
+ ThetvdbMapper::Episode.new(episode_id).data # return episode
31
+ ThetvdbMapper::FullSeries.new(series_id).data # return series with all episodes
32
+ ThetvdbMapper::Series.new(series_id).data # return series
33
+ ```
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,13 @@
1
+ class ThetvdbMapper::Actors < ThetvdbMapper::Base
2
+ def data
3
+ @data ||= fetcher.actors(id).body.map { |actor| map(actor) }
4
+ end
5
+
6
+ def map(data)
7
+ ThetvdbMapper::Mapping::Actor.map(data)
8
+ end
9
+
10
+ def inspect
11
+ "<ThetvdbMapper::Actors data=#{data.to_s} >"
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class ThetvdbMapper::Banners < ThetvdbMapper::Base
2
+ def data
3
+ @data ||= fetcher.banners(id).body.map { |banner| map(banner) }
4
+ end
5
+
6
+ def map(data)
7
+ ThetvdbMapper::Mapping::Banner.map(data)
8
+ end
9
+
10
+ def inspect
11
+ "<ThetvdbMapper::Banners data=#{data.to_s} >"
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ class ThetvdbMapper::Base
2
+ attr_reader :id
3
+
4
+ def initialize(id)
5
+ @id = id
6
+ end
7
+
8
+ def fetcher
9
+ @fetcher ||= ThetvdbMapper::Fetcher.new
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ class ThetvdbMapper::Episode < ThetvdbMapper::Base
2
+ def data
3
+ @data ||= ThetvdbMapper::Mapping::Episode.map(fetcher.episode(id).body)
4
+ end
5
+
6
+ def inspect
7
+ "<ThetvdbMapper::Episode data=#{data.to_s} >"
8
+ end
9
+ end
@@ -0,0 +1,25 @@
1
+ class ThetvdbMapper::Fetcher
2
+ def series(id)
3
+ @series ||= client.series.find(id, mapping: true)
4
+ end
5
+
6
+ def full_series(id)
7
+ @full_series ||= client.series.find_full(id, mapping: true)
8
+ end
9
+
10
+ def actors(id)
11
+ @actors ||= client.actor.find(id, mapping: true)
12
+ end
13
+
14
+ def banners(id)
15
+ @banners ||= client.banner.find(id, mapping: true)
16
+ end
17
+
18
+ def episode(id)
19
+ @episode ||= client.episode.find(id, mapping: true)
20
+ end
21
+
22
+ def client
23
+ ThetvdbApi::Client.new
24
+ end
25
+ end
@@ -0,0 +1,37 @@
1
+ class ThetvdbMapper::FullSeries < ThetvdbMapper::Base
2
+ def data
3
+ @data ||= series.merge(episodes: episodes, actors: actors, banners: banners)
4
+ end
5
+
6
+ def series
7
+ ThetvdbMapper::Mapping::Series.map(fetcher.full_series(id).body['Series'])
8
+ end
9
+
10
+ def episodes
11
+ fetcher.full_series(id).body['Episode'].map { |episode| map_episode(episode) }
12
+ end
13
+
14
+ def map_episode(data)
15
+ ThetvdbMapper::Mapping::Episode.map(data)
16
+ end
17
+
18
+ def actors
19
+ fetcher.actors(id).body.map { |actor| map_actor(actor) }
20
+ end
21
+
22
+ def map_actor(data)
23
+ ThetvdbMapper::Mapping::Actor.map(data)
24
+ end
25
+
26
+ def banners
27
+ fetcher.banners(id).body.map { |banner| map_banner(banner) }
28
+ end
29
+
30
+ def map_banner(data)
31
+ ThetvdbMapper::Mapping::Banner.map(data)
32
+ end
33
+
34
+ def inspect
35
+ "<ThetvdbMapper::FullSeries data=#{data.to_s} >"
36
+ end
37
+ end
@@ -0,0 +1,11 @@
1
+ class ThetvdbMapper::Mapping::Actor < ThetvdbMapper::Mapping::Base
2
+ def self.rules
3
+ {
4
+ 'id' => :id,
5
+ 'Image' => :image_path,
6
+ 'Name' => :name,
7
+ 'Role' => :role,
8
+ 'SortOrder' => :sort_order
9
+ }
10
+ end
11
+ end
@@ -0,0 +1,17 @@
1
+ class ThetvdbMapper::Mapping::Banner < ThetvdbMapper::Mapping::Base
2
+ def self.rules
3
+ {
4
+ 'BannerPath' => :path,
5
+ 'ThumbnailPath' => :thumbnail_path,
6
+ 'VignettePath' => :vignette_path,
7
+ 'BannerType' => :type,
8
+ 'BannerType2' => :type2,
9
+ 'Language' => :language,
10
+ 'Season' => :season,
11
+ 'Rating' => :rating,
12
+ 'RatingCount' => :rating_count,
13
+ 'SeriesName' => :series_name,
14
+ 'Colors' => :colors,
15
+ }
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ class ThetvdbMapper::Mapping::Base
2
+ def self.map(data)
3
+ rules.each do |before, after|
4
+ data[after] = data.delete(before)
5
+ end
6
+
7
+ if respond_to?(:convert)
8
+ data = convert(data)
9
+ end
10
+
11
+ data
12
+ end
13
+
14
+ def self.convert_to_list(data)
15
+ ThetvdbMapper::Mapping::StringList.map(data)
16
+ end
17
+ end
@@ -0,0 +1,45 @@
1
+ class ThetvdbMapper::Mapping::Episode < ThetvdbMapper::Mapping::Base
2
+ def self.rules
3
+ {
4
+ 'id' => :id,
5
+ 'Combined_episodenumber' => :combined_episode_number,
6
+ 'Combined_season' => :combined_season,
7
+ 'DVD_episodenumber' => :dvd_episode_number,
8
+ 'DVD_season' => :dvd_season,
9
+ 'Director' => :director,
10
+ 'EpImgFlag' => :ep_img_flag,
11
+ 'EpisodeName' => :name,
12
+ 'EpisodeNumber' => :number,
13
+ 'FirstAired' => :first_aired,
14
+ 'GuestStars' => :guest_stars,
15
+ 'IMDB_ID' => :imdb_id,
16
+ 'Language' => :language,
17
+ 'Overview' => :overview,
18
+ 'ProductionCode' => :production_code,
19
+ 'Rating' => :rating,
20
+ 'RatingCount' => :rating_count,
21
+ 'SeasonNumber' => :season,
22
+ 'Writer' => :writer,
23
+ 'absolute_number' => :absolute_number,
24
+ 'airsafter_season' => :airs_after_season,
25
+ 'airsbefore_episode' => :airs_before_episode,
26
+ 'airsbefore_season' => :airs_before_season,
27
+ 'filename' => :filename_path,
28
+ 'lastupdated' => :last_updated_at,
29
+ 'season_id' => :season_id,
30
+ 'series_id' => :series_id,
31
+ 'thumb_added' => :thumbnail_added_at,
32
+ 'thumb_height' => :thumbnail_height,
33
+ 'thumb_weight' => :thumbnail_width
34
+ }
35
+ end
36
+
37
+ def self.convert(data)
38
+ data.merge({
39
+ director: convert_to_list(data[:director]),
40
+ guest_stars: convert_to_list(data[:guest_stars]),
41
+ writer: convert_to_list(data[:writer]),
42
+ last_updated_at: Time.at(data[:last_updated_at].to_i)
43
+ })
44
+ end
45
+ end
@@ -0,0 +1,36 @@
1
+ class ThetvdbMapper::Mapping::Series < ThetvdbMapper::Mapping::Base
2
+ def self.rules
3
+ {
4
+ 'id' => :id,
5
+ 'Airs_DayOfWeek' => :airs_day_of_week,
6
+ 'Airs_Time' => :airs_time,
7
+ 'ContentRating' => :content_rating,
8
+ 'FirstAired' => :first_aired,
9
+ 'genre' => :genres,
10
+ 'IMDB_ID' => :imdb_id,
11
+ 'Language' => :language,
12
+ 'Network' => :network,
13
+ 'NetworkID' => :network_id,
14
+ 'Overview' => :overview,
15
+ 'Rating' => :rating,
16
+ 'RatingCount' => :rating_count,
17
+ 'Runtime' => :runtime,
18
+ 'SeriesName' => :name,
19
+ 'Status' => :status,
20
+ 'added' => :added_at,
21
+ 'added_by' => :added_by,
22
+ 'banner' => :banner_path,
23
+ 'fanart' => :fanart_path,
24
+ 'lastupdated' => :last_updated_at,
25
+ 'poster' => :poster_path,
26
+ 'zap2it_id' => :zap2it_id
27
+ }
28
+ end
29
+
30
+ def self.convert(data)
31
+ data.merge({
32
+ genres: convert_to_list(data[:genres]),
33
+ last_updated_at: Time.at(data[:last_updated_at].to_i)
34
+ })
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ class ThetvdbMapper::Mapping::StringList
2
+ def self.map(data)
3
+ data.to_s.split('|').reject{ |element| element.empty? }
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class ThetvdbMapper::Series < ThetvdbMapper::Base
2
+ def data
3
+ @data ||= ThetvdbMapper::Mapping::Series.map(fetcher.series(id).body)
4
+ end
5
+
6
+ def inspect
7
+ "<ThetvdbMapper::Series data=#{data.to_s} >"
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module ThetvdbMapper
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,18 @@
1
+ module ThetvdbMapper
2
+ module Mapping; end
3
+ end
4
+
5
+ require 'thetvdb_mapper/version'
6
+ require 'thetvdb_mapper/fetcher'
7
+ require 'thetvdb_mapper/mapping/base'
8
+ require 'thetvdb_mapper/mapping/actor'
9
+ require 'thetvdb_mapper/mapping/banner'
10
+ require 'thetvdb_mapper/mapping/episode'
11
+ require 'thetvdb_mapper/mapping/series'
12
+ require 'thetvdb_mapper/mapping/string_list'
13
+ require 'thetvdb_mapper/base'
14
+ require 'thetvdb_mapper/actors'
15
+ require 'thetvdb_mapper/banners'
16
+ require 'thetvdb_mapper/episode'
17
+ require 'thetvdb_mapper/full_series'
18
+ require 'thetvdb_mapper/series'
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe ThetvdbMapper::Mapping::Actor do
4
+ let(:klass) { ThetvdbMapper::Mapping::Actor }
5
+
6
+ describe '#map' do
7
+ it 'should return specific keys' do
8
+ klass.map({}).keys.sort.should == [:id, :image_path, :name, :role, :sort_order].sort
9
+ end
10
+
11
+ it 'should map id' do
12
+ klass.map('id' => 1234)[:id].should == 1234
13
+ end
14
+
15
+ it 'should map Image' do
16
+ klass.map('Image' => 'test')[:image_path].should == 'test'
17
+ end
18
+
19
+ it 'should map Name' do
20
+ klass.map('Name' => 'test')[:name].should == 'test'
21
+ end
22
+
23
+ it 'should map Role' do
24
+ klass.map('Role' => 'test')[:role].should == 'test'
25
+ end
26
+
27
+ it 'should map SortOrder' do
28
+ klass.map('SortOrder' => 1)[:sort_order].should == 1
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,56 @@
1
+ require 'spec_helper'
2
+
3
+ describe ThetvdbMapper::Mapping::Banner do
4
+ let(:klass) { ThetvdbMapper::Mapping::Banner }
5
+
6
+ describe '#map' do
7
+ it 'should return specific keys' do
8
+ klass.map({}).keys.sort.should == [:path, :thumbnail_path, :vignette_path, :type, :type2, :language, :season,
9
+ :rating, :rating_count, :series_name, :colors].sort
10
+ end
11
+
12
+ it 'should map BannerPath' do
13
+ klass.map('BannerPath' => 'test')[:path].should == 'test'
14
+ end
15
+
16
+ it 'should map ThumbnailPath' do
17
+ klass.map('ThumbnailPath' => 'test')[:thumbnail_path].should == 'test'
18
+ end
19
+
20
+ it 'should map VignettePath' do
21
+ klass.map('VignettePath' => 'test')[:vignette_path].should == 'test'
22
+ end
23
+
24
+ it 'should map BannerType' do
25
+ klass.map('BannerType' => 'test')[:type].should == 'test'
26
+ end
27
+
28
+ it 'should map BannerType2' do
29
+ klass.map('BannerType2' => 'test')[:type2].should == 'test'
30
+ end
31
+
32
+ it 'should map Language' do
33
+ klass.map('Language' => 'test')[:language].should == 'test'
34
+ end
35
+
36
+ it 'should map Season' do
37
+ klass.map('Season' => 'test')[:season].should == 'test'
38
+ end
39
+
40
+ it 'should map Rating' do
41
+ klass.map('Rating' => 'test')[:rating].should == 'test'
42
+ end
43
+
44
+ it 'should map RatingCount' do
45
+ klass.map('RatingCount' => 'test')[:rating_count].should == 'test'
46
+ end
47
+
48
+ it 'should map SeriesName' do
49
+ klass.map('SeriesName' => 'test')[:series_name].should == 'test'
50
+ end
51
+
52
+ it 'should map Colors' do
53
+ klass.map('Colors' => 'test')[:colors].should == 'test'
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,135 @@
1
+ require 'spec_helper'
2
+
3
+ describe ThetvdbMapper::Mapping::Episode do
4
+ let(:klass) { ThetvdbMapper::Mapping::Episode }
5
+
6
+ describe '#map' do
7
+ it 'should return specific keys' do
8
+ klass.map({}).keys.sort.should == [:id, :combined_episode_number, :combined_season, :dvd_episode_number,
9
+ :dvd_season, :director, :ep_img_flag, :name, :number, :first_aired, :guest_stars, :imdb_id, :language,
10
+ :overview, :production_code, :rating, :rating_count, :season, :writer, :absolute_number, :airs_after_season,
11
+ :airs_before_episode, :airs_before_season, :filename_path, :last_updated_at, :season_id, :series_id,
12
+ :thumbnail_added_at, :thumbnail_height, :thumbnail_width].sort
13
+ end
14
+
15
+ it 'should map id' do
16
+ klass.map('id' => 1234)[:id].should == 1234
17
+ end
18
+
19
+ it 'should map Combined_episodenumber' do
20
+ klass.map('Combined_episodenumber' => 1234)[:combined_episode_number].should == 1234
21
+ end
22
+
23
+ it 'should map Combined_season' do
24
+ klass.map('Combined_season' => 1234)[:combined_season].should == 1234
25
+ end
26
+
27
+ it 'should map DVD_episodenumber' do
28
+ klass.map('DVD_episodenumber' => 1234)[:dvd_episode_number].should == 1234
29
+ end
30
+
31
+ it 'should map DVD_season' do
32
+ klass.map('DVD_season' => 1234)[:dvd_season].should == 1234
33
+ end
34
+
35
+ it 'should map Director' do
36
+ klass.map('Director' => '|test|')[:director].should == ['test']
37
+ end
38
+
39
+ it 'should map EpImgFlag' do
40
+ klass.map('EpImgFlag' => 1234)[:ep_img_flag].should == 1234
41
+ end
42
+
43
+ it 'should map EpisodeName' do
44
+ klass.map('EpisodeName' => 'test')[:name].should == 'test'
45
+ end
46
+
47
+ it 'should map EpisodeNumber' do
48
+ klass.map('EpisodeNumber' => 1234)[:number].should == 1234
49
+ end
50
+
51
+ it 'should map FirstAired' do
52
+ klass.map('FirstAired' => 1234)[:first_aired].should == 1234
53
+ end
54
+
55
+ it 'should map GuestStars' do
56
+ klass.map('GuestStars' => '|test|')[:guest_stars].should == ['test']
57
+ end
58
+
59
+ it 'should map IMDB_ID' do
60
+ klass.map('IMDB_ID' => 'test')[:imdb_id].should == 'test'
61
+ end
62
+
63
+ it 'should map Language' do
64
+ klass.map('Language' => 'test')[:language].should == 'test'
65
+ end
66
+
67
+ it 'should map Overview' do
68
+ klass.map('Overview' => 'test')[:overview].should == 'test'
69
+ end
70
+
71
+ it 'should map ProductionCode' do
72
+ klass.map('ProductionCode' => 'test')[:production_code].should == 'test'
73
+ end
74
+
75
+ it 'should map Rating' do
76
+ klass.map('Rating' => '1.0')[:rating].should == '1.0'
77
+ end
78
+
79
+ it 'should map RatingCount' do
80
+ klass.map('RatingCount' => '1')[:rating_count].should == '1'
81
+ end
82
+
83
+ it 'should map SeasonNumber' do
84
+ klass.map('SeasonNumber' => '1')[:season].should == '1'
85
+ end
86
+
87
+ it 'should map Writer' do
88
+ klass.map('Writer' => '|test|')[:writer].should == ['test']
89
+ end
90
+
91
+ it 'should map absolute_number' do
92
+ klass.map('absolute_number' => '1')[:absolute_number].should == '1'
93
+ end
94
+
95
+ it 'should map airsafter_season' do
96
+ klass.map('airsafter_season' => '1')[:airs_after_season].should == '1'
97
+ end
98
+
99
+ it 'should map airsbefore_episode' do
100
+ klass.map('airsbefore_episode' => '1')[:airs_before_episode].should == '1'
101
+ end
102
+
103
+ it 'should map airsbefore_season' do
104
+ klass.map('airsbefore_season' => '1')[:airs_before_season].should == '1'
105
+ end
106
+
107
+ it 'should map filename' do
108
+ klass.map('filename' => 'test')[:filename_path].should == 'test'
109
+ end
110
+
111
+ it 'should map lastupdated' do
112
+ klass.map('lastupdated' => '1234')[:last_updated_at].should == Time.at(1234)
113
+ end
114
+
115
+ it 'should map season_id' do
116
+ klass.map('season_id' => '1')[:season_id].should == '1'
117
+ end
118
+
119
+ it 'should map series_id' do
120
+ klass.map('series_id' => '1')[:series_id].should == '1'
121
+ end
122
+
123
+ it 'should map thumb_added' do
124
+ klass.map('thumb_added' => 'test')[:thumbnail_added_at].should == 'test'
125
+ end
126
+
127
+ it 'should map thumb_height' do
128
+ klass.map('thumb_height' => 'test')[:thumbnail_height].should == 'test'
129
+ end
130
+
131
+ it 'should map thumb_weight' do
132
+ klass.map('thumb_weight' => 'test')[:thumbnail_width].should == 'test'
133
+ end
134
+ end
135
+ end