tvdb_party 0.3.3 → 0.4.0

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.4.0
@@ -0,0 +1,18 @@
1
+ module TvdbParty
2
+ class Actor
3
+ attr_accessor :id, :name, :role, :image
4
+
5
+ def initialize(options={})
6
+ @id = options["id"]
7
+ @name = options["Name"]
8
+ @role = options["Role"]
9
+ @image = options["Image"]
10
+ end
11
+
12
+ def image_url
13
+ return nil unless @image
14
+ "http://thetvdb.com/banners/" + @image
15
+ end
16
+
17
+ end
18
+ end
@@ -3,6 +3,7 @@ module TvdbParty
3
3
  include HTTParty
4
4
  include HTTParty::Icebox
5
5
  attr_accessor :language
6
+ format :xml
6
7
  cache :store => 'file', :timeout => 120, :location => Dir.tmpdir
7
8
 
8
9
  base_uri 'www.thetvdb.com/api'
@@ -44,6 +45,15 @@ module TvdbParty
44
45
  end
45
46
  end
46
47
 
48
+ def get_actors(series)
49
+ response = self.class.get("/#{@api_key}/series/#{series.id}/actors.xml")
50
+ if response["Actors"] && response["Actors"]["Actor"]
51
+ response["Actors"]["Actor"].collect {|a| Actor.new(a)}
52
+ else
53
+ nil
54
+ end
55
+ end
56
+
47
57
  def get_banners(series)
48
58
  response = self.class.get("/#{@api_key}/series/#{series.id}/banners.xml")
49
59
  return [] unless response["Banners"] && response["Banners"]["Banner"]
@@ -19,12 +19,6 @@ module TvdbParty
19
19
  @genres = []
20
20
  end
21
21
 
22
- if options["Actors"]
23
- @actors = options["Actors"][1..-1].split("|")
24
- else
25
- @actors = []
26
- end
27
-
28
22
  if options["Rating"] && options["Rating"].size > 0
29
23
  @rating = options["Rating"].to_f
30
24
  else
@@ -36,7 +30,6 @@ module TvdbParty
36
30
  rescue
37
31
  puts 'invalid date'
38
32
  end
39
-
40
33
  end
41
34
 
42
35
  def get_episode(season_number, episode_number)
@@ -70,6 +63,10 @@ module TvdbParty
70
63
  def seasons
71
64
  @seasons ||= client.get_seasons(self)
72
65
  end
66
+
67
+ def actors
68
+ @actors ||= client.get_actors(self)
69
+ end
73
70
 
74
71
  def season(season_number)
75
72
  seasons.detect{|s| s.number == season_number}
data/lib/tvdb_party.rb CHANGED
@@ -7,3 +7,4 @@ require File.join(directory, 'tvdb_party', 'search')
7
7
  require File.join(directory, 'tvdb_party', 'series')
8
8
  require File.join(directory, 'tvdb_party', 'episode')
9
9
  require File.join(directory, 'tvdb_party', 'banner')
10
+ require File.join(directory, 'tvdb_party', 'actor')
@@ -35,6 +35,14 @@ class TvdbPartyTest < Test::Unit::TestCase
35
35
  assert_equal TvdbParty::Series, @series.class
36
36
  end
37
37
 
38
+ should "have actors" do
39
+ assert_not_equal 0, @series.actors.size
40
+ end
41
+
42
+ should "have actual Actors" do
43
+ assert_equal TvdbParty::Actor, @series.actors.first.class
44
+ end
45
+
38
46
  should "have a first episode" do
39
47
  assert_equal "110413", @series.get_episode(1, 1).id
40
48
  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.3.3"
8
+ s.version = "0.4.0"
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{2010-05-24}
12
+ s.date = %q{2010-07-06}
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 = [
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "lib/tvdb_party.rb",
27
+ "lib/tvdb_party/actor.rb",
27
28
  "lib/tvdb_party/banner.rb",
28
29
  "lib/tvdb_party/episode.rb",
29
30
  "lib/tvdb_party/httparty_icebox.rb",
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.3.3
4
+ version: 0.4.0
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: 2010-05-24 00:00:00 -04:00
12
+ date: 2010-07-06 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -49,6 +49,7 @@ files:
49
49
  - Rakefile
50
50
  - VERSION
51
51
  - lib/tvdb_party.rb
52
+ - lib/tvdb_party/actor.rb
52
53
  - lib/tvdb_party/banner.rb
53
54
  - lib/tvdb_party/episode.rb
54
55
  - lib/tvdb_party/httparty_icebox.rb