tvdb-rb 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.
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Data>
3
+ <Series>
4
+ <seriesid>81189</seriesid>
5
+ <language>en</language>
6
+ <SeriesName>Breaking Bad</SeriesName>
7
+ <banner>graphical/81189-g20.jpg</banner>
8
+ <Overview>Walter White, a struggling high school chemistry teacher is diagnosed with advanced lung cancer. He turns to a life of crime, producing and selling methamphetamine accompanied by a former student, Jesse Pinkman with the aim of securing his family's financial future before he dies.</Overview>
9
+ <FirstAired>2008-01-20</FirstAired>
10
+ <IMDB_ID>tt0903747</IMDB_ID>
11
+ <zap2it_id>SH01009396</zap2it_id>
12
+ <id>81189</id>
13
+ </Series>
14
+ </Data>
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Data>
3
+ <Series>
4
+ <id>81189</id>
5
+ <Actors>|Bryan Cranston|Aaron Paul|Dean Norris|RJ Mitte|Betsy Brandt|Anna Gunn|Christopher Cousins|Steven Michael Quezada|Jonathan Banks|Giancarlo Esposito|Bob Odenkirk|</Actors>
6
+ <Airs_DayOfWeek>Sunday</Airs_DayOfWeek>
7
+ <Airs_Time>10:00 PM</Airs_Time>
8
+ <ContentRating>TV-MA</ContentRating>
9
+ <FirstAired>2008-01-20</FirstAired>
10
+ <Genre>|Drama|</Genre>
11
+ <IMDB_ID>tt0903747</IMDB_ID>
12
+ <Language>en</Language>
13
+ <Network>AMC</Network>
14
+ <NetworkID/>
15
+ <Overview>Walter White, a struggling high school chemistry teacher is diagnosed with advanced lung cancer. He turns to a life of crime, producing and selling methamphetamine accompanied by a former student, Jesse Pinkman with the aim of securing his family's financial future before he dies.</Overview>
16
+ <Rating>9.3</Rating>
17
+ <RatingCount>369</RatingCount>
18
+ <Runtime>60</Runtime>
19
+ <SeriesID>74713</SeriesID>
20
+ <SeriesName>Breaking Bad</SeriesName>
21
+ <Status>Continuing</Status>
22
+ <added/>
23
+ <addedBy/>
24
+ <banner>graphical/81189-g20.jpg</banner>
25
+ <fanart>fanart/original/81189-50.jpg</fanart>
26
+ <lastupdated>1349262685</lastupdated>
27
+ <poster>posters/81189-8.jpg</poster>
28
+ <zap2it_id>SH01009396</zap2it_id>
29
+ </Series>
30
+ </Data>
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe TVDB::Client do
4
+
5
+ before do
6
+ @client = TVDB::Client.new("foo")
7
+ end
8
+
9
+ it "should return results for get_series_by_name" do
10
+ stub_request(:get, "http://www.thetvdb.com/api/GetSeries.php?seriesname=Breaking%20Bad").to_return(:body => load_response("get_series.xml"), :status => 200)
11
+ stub_request(:get, "http://www.thetvdb.com/api/foo/series/81189").to_return(:body => load_response("get_series_detail.xml"), :status => 200)
12
+ results = @client.get_series_by_name "Breaking Bad", detailed_response=true
13
+ results.length.should eq 1
14
+ breaking_bad = results.first
15
+ breaking_bad.series_name.should eq "Breaking Bad"
16
+ breaking_bad.genres.should eq ["Drama"]
17
+ breaking_bad.actors.should eq ["Bryan Cranston", "Aaron Paul", "Dean Norris", "RJ Mitte", "Betsy Brandt", "Anna Gunn", "Christopher Cousins", "Steven Michael Quezada", "Jonathan Banks", "Giancarlo Esposito", "Bob Odenkirk"]
18
+ end
19
+
20
+ it "should return episodes for a series" do
21
+ stub_request(:get, "http://www.thetvdb.com/api/GetSeries.php?seriesname=Breaking%20Bad").to_return(:body => load_response("get_series.xml"), :status => 200)
22
+ stub_request(:get, "http://www.thetvdb.com/api/foo/series/81189/all").to_return(:body => load_response("episodes.xml"), :status => 200)
23
+ breaking_bad = @client.get_series_by_name("Breaking Bad", detailed_response=false).first
24
+ breaking_bad.episodes.all.should be_a Array
25
+ breaking_bad.episodes.all.length.should eq 60
26
+ end
27
+
28
+ it "should return epsiodes when searched for by overview" do
29
+ stub_request(:get, "http://www.thetvdb.com/api/GetSeries.php?seriesname=Breaking%20Bad").to_return(:body => load_response("get_series.xml"), :status => 200)
30
+ stub_request(:get, "http://www.thetvdb.com/api/foo/series/81189/all").to_return(:body => load_response("episodes.xml"), :status => 200)
31
+ stub_request(:get, "http://www.thetvdb.com/api/foo/series/81189").to_return(:body => load_response("episodes.xml"), :status => 200)
32
+ breaking_bad = @client.get_series_by_name("Breaking Bad", detailed_response=true).first
33
+ episodes = breaking_bad.episodes.search_by_overview "chemistry"
34
+ episodes.all.length.should eq 1
35
+ end
36
+
37
+ end
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "tvdb-rb"
7
+ gem.version = "0.1"
8
+ gem.authors = ["George Sheppard"]
9
+ gem.email = ["george@fuzzmonkey.co.uk"]
10
+ gem.description = %q{A work in progress library for thetvdb XML API.}
11
+ gem.summary = %q{}
12
+ gem.homepage = ""
13
+
14
+ gem.files = `git ls-files`.split($/)
15
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
+ gem.require_paths = ["lib"]
18
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tvdb-rb
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - George Sheppard
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-03 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: A work in progress library for thetvdb XML API.
15
+ email:
16
+ - george@fuzzmonkey.co.uk
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - lib/tvdb-rb.rb
27
+ - lib/tvdb-rb/client.rb
28
+ - lib/tvdb-rb/episode.rb
29
+ - lib/tvdb-rb/episodes.rb
30
+ - lib/tvdb-rb/series.rb
31
+ - spec/spec_helper.rb
32
+ - spec/support/canned_responses/episodes.xml
33
+ - spec/support/canned_responses/get_series.xml
34
+ - spec/support/canned_responses/get_series_detail.xml
35
+ - spec/unit/tvdv-rb_spec.rb
36
+ - tvdb-rb.gemspec
37
+ homepage: ''
38
+ licenses: []
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubyforge_project:
57
+ rubygems_version: 1.8.24
58
+ signing_key:
59
+ specification_version: 3
60
+ summary: ''
61
+ test_files:
62
+ - spec/spec_helper.rb
63
+ - spec/support/canned_responses/episodes.xml
64
+ - spec/support/canned_responses/get_series.xml
65
+ - spec/support/canned_responses/get_series_detail.xml
66
+ - spec/unit/tvdv-rb_spec.rb