tvdb_party 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -9,12 +9,15 @@ module TvdbParty
9
9
 
10
10
  def search(series_name)
11
11
  response = self.class.get("/GetSeries.php", {:query => {:seriesname => series_name}})
12
- response["Data"]["Series"]
12
+ return [] unless response["Data"]
13
+
13
14
  case response["Data"]["Series"]
14
15
  when Array
15
16
  response["Data"]["Series"]
16
17
  when Hash
17
18
  [response["Data"]["Series"]]
19
+ else
20
+ []
18
21
  end
19
22
  end
20
23
 
@@ -12,10 +12,10 @@ module TvdbParty
12
12
  @overview = options["Overview"]
13
13
  @network = options["Network"]
14
14
  @runtime = options["Runtime"]
15
- @first_aired = Date.parse(options["FirstAired"])
15
+ @first_aired = Date.parse(options["FirstAired"]) if options["FirstAired"]
16
16
 
17
- @genres = options["Genre"][1..-1].split("|")
18
- @actors = options["Actors"][1..-1].split("|")
17
+ @genres = options["Genre"][1..-1].split("|") if options["Genre"]
18
+ @actors = options["Actors"][1..-1].split("|")if options["Actors"]
19
19
 
20
20
  if options["Rating"] && options["Rating"].size > 0
21
21
  @rating = options["Rating"].to_f
@@ -1,7 +1,43 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class TvdbPartyTest < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
4
+ context "tvdb search" do
5
+ setup do
6
+ @tvdb = TvdbParty::Search.new('A97A9243F8030477')
7
+ end
8
+
9
+ context "search for terrible query" do
10
+ setup do
11
+ @results = @tvdb.search("sdfsafsdfds")
12
+ end
13
+
14
+ should "have 0 results" do
15
+ assert_equal 0, @results.size
16
+ end
17
+
18
+ end
19
+
20
+ context "search for real show" do
21
+ setup do
22
+ @results = @tvdb.search("jojos")
23
+ end
24
+
25
+ should "have 0 results" do
26
+ assert_equal 2, @results.size
27
+ end
28
+
29
+ context "get the series" do
30
+ setup do
31
+ @series = @tvdb.get_series_by_id(@results.first['seriesid'])
32
+ end
33
+
34
+ should "have a series" do
35
+ assert_equal TvdbParty::Series, @series.class
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+
6
42
  end
7
43
  end
data/tvdb_party.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tvdb_party}
8
- s.version = "0.1.5"
8
+ s.version = "0.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jon Maddox"]
12
- s.date = %q{2009-10-10}
12
+ s.date = %q{2009-10-15}
13
13
  s.description = %q{Simple Ruby library to talk to thetvdb.com's api}
14
14
  s.email = %q{jon@mustacheinc.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tvdb_party
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Maddox
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-10 00:00:00 -04:00
12
+ date: 2009-10-15 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency