thetvdb_api 0.2.1 → 0.2.2

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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/README.md +36 -81
  4. data/lib/thetvdb_api/actor.rb +15 -1
  5. data/lib/thetvdb_api/banner.rb +15 -1
  6. data/lib/thetvdb_api/base.rb +4 -4
  7. data/lib/thetvdb_api/episode.rb +50 -5
  8. data/lib/thetvdb_api/response/actors.rb +7 -0
  9. data/lib/thetvdb_api/response/banners.rb +7 -0
  10. data/lib/thetvdb_api/response/collection.rb +9 -0
  11. data/lib/thetvdb_api/response/episode.rb +5 -0
  12. data/lib/thetvdb_api/response/full_series.rb +21 -0
  13. data/lib/thetvdb_api/response/search_multiple_episode.rb +7 -0
  14. data/lib/thetvdb_api/response/search_multiple_series.rb +7 -0
  15. data/lib/thetvdb_api/response/search_series.rb +5 -0
  16. data/lib/thetvdb_api/response/series.rb +5 -0
  17. data/lib/thetvdb_api/response/update.rb +31 -0
  18. data/lib/thetvdb_api/response.rb +30 -8
  19. data/lib/thetvdb_api/search.rb +50 -4
  20. data/lib/thetvdb_api/series.rb +28 -2
  21. data/lib/thetvdb_api/update.rb +24 -8
  22. data/lib/thetvdb_api/version.rb +1 -1
  23. data/lib/thetvdb_api.rb +11 -1
  24. data/spec/integrations/actor_spec.rb +1 -1
  25. data/spec/integrations/banner_spec.rb +1 -1
  26. data/spec/integrations/client_spec.rb +15 -15
  27. data/spec/integrations/episode_spec.rb +4 -4
  28. data/spec/integrations/search_spec.rb +4 -4
  29. data/spec/integrations/series_spec.rb +2 -2
  30. data/spec/integrations/update_spec.rb +4 -4
  31. data/spec/spec_helper.rb +0 -21
  32. data/spec/units/actor_spec.rb +49 -0
  33. data/spec/units/banner_spec.rb +49 -0
  34. data/spec/units/episode_spec.rb +167 -0
  35. data/spec/units/response/actors_spec.rb +15 -0
  36. data/spec/units/response/banners_spec.rb +15 -0
  37. data/spec/units/response/collection_spec.rb +38 -0
  38. data/spec/units/response/episode_spec.rb +15 -0
  39. data/spec/units/response/full_series_spec.rb +51 -0
  40. data/spec/units/response/search_multiple_episode_spec.rb +15 -0
  41. data/spec/units/response/search_multiple_series_spec.rb +15 -0
  42. data/spec/units/response/search_series_spec.rb +15 -0
  43. data/spec/units/response/series_spec.rb +15 -0
  44. data/spec/units/response/update_spec.rb +79 -0
  45. data/spec/units/response_spec.rb +100 -0
  46. data/spec/units/search_spec.rb +178 -0
  47. data/spec/units/series_spec.rb +92 -0
  48. data/spec/units/update_spec.rb +178 -0
  49. data/thetvdb_api.gemspec +1 -1
  50. metadata +53 -49
  51. data/lib/thetvdb_api/mappers/actor.rb +0 -17
  52. data/lib/thetvdb_api/mappers/actors.rb +0 -10
  53. data/lib/thetvdb_api/mappers/banner.rb +0 -32
  54. data/lib/thetvdb_api/mappers/banners.rb +0 -10
  55. data/lib/thetvdb_api/mappers/base_mapper.rb +0 -13
  56. data/lib/thetvdb_api/mappers/episode.rb +0 -35
  57. data/lib/thetvdb_api/mappers/full_series.rb +0 -12
  58. data/lib/thetvdb_api/mappers/search_episode.rb +0 -10
  59. data/lib/thetvdb_api/mappers/search_series/series.rb +0 -25
  60. data/lib/thetvdb_api/mappers/search_series.rb +0 -10
  61. data/lib/thetvdb_api/mappers/series.rb +0 -40
  62. data/lib/thetvdb_api/mappers/update/banner.rb +0 -19
  63. data/lib/thetvdb_api/mappers/update/element.rb +0 -10
  64. data/lib/thetvdb_api/mappers/update/episode.rb +0 -8
  65. data/lib/thetvdb_api/mappers/update/series.rb +0 -8
  66. data/lib/thetvdb_api/mappers/update.rb +0 -14
  67. data/spec/thetvdb_api/actor_spec.rb +0 -21
  68. data/spec/thetvdb_api/banner_spec.rb +0 -21
  69. data/spec/thetvdb_api/episode_spec.rb +0 -63
  70. data/spec/thetvdb_api/mappers/actor_spec.rb +0 -15
  71. data/spec/thetvdb_api/mappers/banner_spec.rb +0 -31
  72. data/spec/thetvdb_api/mappers/search_series/series_spec.rb +0 -15
  73. data/spec/thetvdb_api/mappers/series_spec.rb +0 -31
  74. data/spec/thetvdb_api/mappers/update/banner_spec.rb +0 -15
  75. data/spec/thetvdb_api/response_spec.rb +0 -60
  76. data/spec/thetvdb_api/search_spec.rb +0 -63
  77. data/spec/thetvdb_api/series_spec.rb +0 -35
  78. data/spec/thetvdb_api/update_spec.rb +0 -63
  79. /data/spec/{thetvdb_api → units}/base_spec.rb +0 -0
  80. /data/spec/{thetvdb_api → units}/client_spec.rb +0 -0
@@ -1,21 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ThetvdbApi::Banner do
4
- let(:klass) { ThetvdbApi::Banner }
5
- let(:model) { klass.new(ThetvdbApi::Client.new(api_key: '123456789')) }
6
- let(:mock_model) { SampleModel.new }
7
-
8
- describe '.find' do
9
- it 'should call get with specific params' do
10
- model.should_receive(:get).with('{api_key}/series/{series_id}/banners.xml').and_return(mock_model)
11
-
12
- model.find('1234')
13
- end
14
-
15
- it 'should call params with specific params' do
16
- model.should_receive(:params).with(series_id: '1234').and_return(mock_model)
17
-
18
- model.find('1234')
19
- end
20
- end
21
- end
@@ -1,63 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ThetvdbApi::Episode do
4
- let(:klass) { ThetvdbApi::Episode }
5
- let(:model) { klass.new(ThetvdbApi::Client.new(api_key: '123456789')) }
6
- let(:mock_model) { SampleModel.new }
7
-
8
- describe '.find_by_default_order' do
9
- it 'should call get with specific params' do
10
- model.should_receive(:get).with('{api_key}/series/{series_id}/{order}/{season}/{episode}/{language}.xml').and_return(mock_model)
11
-
12
- model.find_by_default_order('1234', '1', '1')
13
- end
14
-
15
- it 'should call params with specific params' do
16
- model.should_receive(:params).with(series_id: '1234', season: '1', episode: '1', order: 'default').and_return(mock_model)
17
-
18
- model.find_by_default_order('1234', '1', '1')
19
- end
20
- end
21
-
22
- describe '.find_by_dvd_order' do
23
- it 'should call get with specific params' do
24
- model.should_receive(:get).with('{api_key}/series/{series_id}/{order}/{season}/{episode}/{language}.xml').and_return(mock_model)
25
-
26
- model.find_by_dvd_order('1234', '1', '1')
27
- end
28
-
29
- it 'should call params with specific params' do
30
- model.should_receive(:params).with(series_id: '1234', season: '1', episode: '1', order: 'dvd').and_return(mock_model)
31
-
32
- model.find_by_dvd_order('1234', '1', '1')
33
- end
34
- end
35
-
36
- describe '.find_by_absolute_order' do
37
- it 'should call get with specific params' do
38
- model.should_receive(:get).with('{api_key}/series/{series_id}/absolute/{absolute}/{language}.xml').and_return(mock_model)
39
-
40
- model.find_by_absolute_order('1234', '1')
41
- end
42
-
43
- it 'should call params with specific params' do
44
- model.should_receive(:params).with(series_id: '1234', absolute: '1').and_return(mock_model)
45
-
46
- model.find_by_absolute_order('1234', '1')
47
- end
48
- end
49
-
50
- describe '.find' do
51
- it 'should call get with specific params' do
52
- model.should_receive(:get).with('{api_key}/episodes/{episode_id}/{language}.xml').and_return(mock_model)
53
-
54
- model.find('1234')
55
- end
56
-
57
- it 'should call params with specific params' do
58
- model.should_receive(:params).with(episode_id: '1234').and_return(mock_model)
59
-
60
- model.find('1234')
61
- end
62
- end
63
- end
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
- require 'thetvdb_api/mappers/actor'
3
-
4
- describe ThetvdbApi::Mappers::Actor do
5
- let(:klass) { ThetvdbApi::Mappers::Actor }
6
- let(:model) { klass.new }
7
-
8
- describe '.image_url' do
9
- it 'should return correct string' do
10
- model.stub(:image_path).and_return('PATH')
11
-
12
- model.image_url.should == 'http://thetvdb.com/banners/PATH'
13
- end
14
- end
15
- end
@@ -1,31 +0,0 @@
1
- require 'spec_helper'
2
- require 'thetvdb_api/mappers/banner'
3
-
4
- describe ThetvdbApi::Mappers::Banner do
5
- let(:klass) { ThetvdbApi::Mappers::Banner }
6
- let(:model) { klass.new }
7
-
8
- describe '.url' do
9
- it 'should return correct string' do
10
- model.stub(:path).and_return('PATH')
11
-
12
- model.url.should == 'http://thetvdb.com/banners/PATH'
13
- end
14
- end
15
-
16
- describe '.thumbnail_url' do
17
- it 'should return correct string' do
18
- model.stub(:thumbnail_path).and_return('PATH')
19
-
20
- model.thumbnail_url.should == 'http://thetvdb.com/banners/PATH'
21
- end
22
- end
23
-
24
- describe '.vignette_url' do
25
- it 'should return correct string' do
26
- model.stub(:vignette_path).and_return('PATH')
27
-
28
- model.vignette_url.should == 'http://thetvdb.com/banners/PATH'
29
- end
30
- end
31
- end
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
- require 'thetvdb_api/mappers/search_series/series'
3
-
4
- describe ThetvdbApi::Mappers::SearchSeries::Series do
5
- let(:klass) { ThetvdbApi::Mappers::SearchSeries::Series }
6
- let(:model) { klass.new }
7
-
8
- describe '.banner_url' do
9
- it 'should return correct string' do
10
- model.stub(:banner_path).and_return('PATH')
11
-
12
- model.banner_url.should == 'http://thetvdb.com/banners/PATH'
13
- end
14
- end
15
- end
@@ -1,31 +0,0 @@
1
- require 'spec_helper'
2
- require 'thetvdb_api/mappers/series'
3
-
4
- describe ThetvdbApi::Mappers::Series do
5
- let(:klass) { ThetvdbApi::Mappers::Series }
6
- let(:model) { klass.new }
7
-
8
- describe '.banner_url' do
9
- it 'should return correct string' do
10
- model.stub(:banner_path).and_return('PATH')
11
-
12
- model.banner_url.should == 'http://thetvdb.com/banners/PATH'
13
- end
14
- end
15
-
16
- describe '.fanart_url' do
17
- it 'should return correct string' do
18
- model.stub(:fanart_path).and_return('PATH')
19
-
20
- model.fanart_url.should == 'http://thetvdb.com/banners/PATH'
21
- end
22
- end
23
-
24
- describe '.poster_url' do
25
- it 'should return correct string' do
26
- model.stub(:poster_path).and_return('PATH')
27
-
28
- model.poster_url.should == 'http://thetvdb.com/banners/PATH'
29
- end
30
- end
31
- end
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
- require 'thetvdb_api/mappers/update/banner'
3
-
4
- describe ThetvdbApi::Mappers::Update::Banner do
5
- let(:klass) { ThetvdbApi::Mappers::Update::Banner }
6
- let(:model) { klass.new }
7
-
8
- describe '.url' do
9
- it 'should return correct string' do
10
- model.stub(:path).and_return('PATH')
11
-
12
- model.url.should == 'http://thetvdb.com/banners/PATH'
13
- end
14
- end
15
- end
@@ -1,60 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ThetvdbApi::Search do
4
- let(:klass) { ThetvdbApi::Response }
5
- let(:model) { klass.new(faraday_response) }
6
- let(:faraday_response) { double(env: true, status: true, headers: true, body: 'TEST') }
7
-
8
- describe '.mapper' do
9
- it 'should set mapper' do
10
- model = klass.new(faraday_response, 'MAPPER')
11
- model.mapper.should == 'MAPPER'
12
- end
13
- end
14
-
15
- describe '.env' do
16
- it 'should call env in faraday_response' do
17
- faraday_response.should_receive(:env)
18
-
19
- model.env
20
- end
21
- end
22
-
23
- describe '.status' do
24
- it 'should call status in faraday_response' do
25
- faraday_response.should_receive(:status)
26
-
27
- model.status
28
- end
29
- end
30
-
31
- describe '.headers' do
32
- it 'should call headers in faraday_response' do
33
- faraday_response.should_receive(:headers)
34
-
35
- model.headers
36
- end
37
- end
38
-
39
- describe '.body' do
40
- it 'should map response when give mapper' do
41
- mapper = double(parse: true)
42
- model = klass.new(faraday_response, mapper)
43
- mapper.should_receive(:parse)
44
-
45
- model.body
46
- end
47
-
48
- it 'should return string' do
49
- model.body.class.should == String
50
- end
51
- end
52
-
53
- describe '.inspect' do
54
- it 'should return correct string' do
55
- model.stub(:body).and_return('BODY')
56
- model.stub(:mapper).and_return('MAPPER')
57
- model.inspect.should == '<ThetvdbApi::Response body="BODY", mapper="MAPPER">'
58
- end
59
- end
60
- end
@@ -1,63 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ThetvdbApi::Search do
4
- let(:klass) { ThetvdbApi::Search }
5
- let(:model) { klass.new(ThetvdbApi::Client.new(api_key: '123456789')) }
6
- let(:mock_model) { SampleModel.new }
7
-
8
- describe '.get_series' do
9
- it 'should call get with specific params' do
10
- model.should_receive(:get).with('GetSeries.php').and_return(mock_model)
11
-
12
- model.get_series('buffy')
13
- end
14
-
15
- it 'should call params with specific params' do
16
- model.should_receive(:params).with(seriesname: 'buffy').and_return(mock_model)
17
-
18
- model.get_series('buffy')
19
- end
20
- end
21
-
22
- describe '.get_series_by_imdb_id' do
23
- it 'should call get with specific params' do
24
- model.should_receive(:get).with('GetSeriesByRemoteID.php').and_return(mock_model)
25
-
26
- model.get_series_by_imdb_id('1234')
27
- end
28
-
29
- it 'should call params with specific params' do
30
- model.should_receive(:params).with(imdbid: '1234').and_return(mock_model)
31
-
32
- model.get_series_by_imdb_id('1234')
33
- end
34
- end
35
-
36
- describe '.get_series_by_zap2it_id' do
37
- it 'should call get with specific params' do
38
- model.should_receive(:get).with('GetSeriesByRemoteID.php').and_return(mock_model)
39
-
40
- model.get_series_by_zap2it_id('1234')
41
- end
42
-
43
- it 'should call params with specific params' do
44
- model.should_receive(:params).with(zap2it: '1234').and_return(mock_model)
45
-
46
- model.get_series_by_zap2it_id('1234')
47
- end
48
- end
49
-
50
- describe '.get_episode' do
51
- it 'should call get with specific params' do
52
- model.should_receive(:get).with('GetEpisodeByAirDate.php').and_return(mock_model)
53
-
54
- model.get_episode('1234', '2000-01-01')
55
- end
56
-
57
- it 'should call params with specific params' do
58
- model.should_receive(:params).with(seriesid: '1234', airdate: '2000-01-01').and_return(mock_model)
59
-
60
- model.get_episode('1234', '2000-01-01')
61
- end
62
- end
63
- end
@@ -1,35 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ThetvdbApi::Series do
4
- let(:klass) { ThetvdbApi::Series }
5
- let(:model) { klass.new(ThetvdbApi::Client.new(api_key: '123456789')) }
6
- let(:mock_model) { SampleModel.new }
7
-
8
- describe '.find' do
9
- it 'should call get with specific params' do
10
- model.should_receive(:get).with('{api_key}/series/{series_id}/{language}.xml').and_return(mock_model)
11
-
12
- model.find('1234')
13
- end
14
-
15
- it 'should call params with specific params' do
16
- model.should_receive(:params).with(series_id: '1234').and_return(mock_model)
17
-
18
- model.find('1234')
19
- end
20
- end
21
-
22
- describe '.find_full' do
23
- it 'should call get with specific params' do
24
- model.should_receive(:get).with('{api_key}/series/{series_id}/all/{language}.xml').and_return(mock_model)
25
-
26
- model.find_full('1234')
27
- end
28
-
29
- it 'should call params with specific params' do
30
- model.should_receive(:params).with(series_id: '1234').and_return(mock_model)
31
-
32
- model.find_full('1234')
33
- end
34
- end
35
- end
@@ -1,63 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ThetvdbApi::Update do
4
- let(:klass) { ThetvdbApi::Update }
5
- let(:model) { klass.new(ThetvdbApi::Client.new(api_key: '123456789')) }
6
- let(:mock_model) { SampleModel.new }
7
-
8
- describe '.day' do
9
- it 'should call get with specific params' do
10
- model.should_receive(:get).with('{api_key}/updates/updates_day.xml').and_return(mock_model)
11
-
12
- model.day
13
- end
14
- end
15
-
16
- describe '.day_url' do
17
- it 'should return correct string' do
18
- model.day_url.should == "http://thetvdb.com/api/#{model.api_key}/updates/updates_day.xml"
19
- end
20
- end
21
-
22
- describe '.week' do
23
- it 'should call get with specific params' do
24
- model.should_receive(:get).with('{api_key}/updates/updates_week.xml').and_return(mock_model)
25
-
26
- model.week
27
- end
28
- end
29
-
30
- describe '.week_url' do
31
- it 'should return correct string' do
32
- model.week_url.should == "http://thetvdb.com/api/#{model.api_key}/updates/updates_week.xml"
33
- end
34
- end
35
-
36
- describe '.month' do
37
- it 'should call get with specific params' do
38
- model.should_receive(:get).with('{api_key}/updates/updates_month.xml').and_return(mock_model)
39
-
40
- model.month
41
- end
42
- end
43
-
44
- describe '.month_url' do
45
- it 'should return correct string' do
46
- model.month_url.should == "http://thetvdb.com/api/#{model.api_key}/updates/updates_month.xml"
47
- end
48
- end
49
-
50
- describe '.all' do
51
- it 'should call get with specific params' do
52
- model.should_receive(:get).with('{api_key}/updates/updates_all.xml').and_return(mock_model)
53
-
54
- model.all
55
- end
56
- end
57
-
58
- describe '.all_url' do
59
- it 'should return correct string' do
60
- model.all_url.should == "http://thetvdb.com/api/#{model.api_key}/updates/updates_all.xml"
61
- end
62
- end
63
- end
File without changes
File without changes