Class: TvdbParty::Episode

Inherits:
Object
  • Object
show all
Defined in:
lib/tvdb_party/episode.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, options = {}) ⇒ Episode

Returns a new instance of Episode.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tvdb_party/episode.rb', line 6

def initialize(client, options={})
  @client = client
  @id = options["id"]
  @season_number = options["SeasonNumber"]
  @number = options["EpisodeNumber"]
  @name = options["EpisodeName"]
  @overview = options["Overview"]
  @thumb = "http://thetvdb.com/banners/" + options["filename"] if options["filename"].to_s != ""
  @director = options["Director"]
  @writer = options["Writer"]
  @series_id = options["seriesid"]
  if options["GuestStars"]
    @guest_stars = options["GuestStars"][1..-1].split("|")
  else
    @guest_stars = []
  end

  begin 
    @air_date = Date.parse(options["FirstAired"])
  rescue
    puts 'invalid date'
  end
end

Instance Attribute Details

#air_dateObject

Returns the value of attribute air_date.



4
5
6
# File 'lib/tvdb_party/episode.rb', line 4

def air_date
  @air_date
end

#clientObject (readonly)

Returns the value of attribute client.



3
4
5
# File 'lib/tvdb_party/episode.rb', line 3

def client
  @client
end

#directorObject

Returns the value of attribute director.



4
5
6
# File 'lib/tvdb_party/episode.rb', line 4

def director
  @director
end

#guest_starsObject

Returns the value of attribute guest_stars.



4
5
6
# File 'lib/tvdb_party/episode.rb', line 4

def guest_stars
  @guest_stars
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/tvdb_party/episode.rb', line 4

def id
  @id
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/tvdb_party/episode.rb', line 4

def name
  @name
end

#numberObject

Returns the value of attribute number.



4
5
6
# File 'lib/tvdb_party/episode.rb', line 4

def number
  @number
end

#overviewObject

Returns the value of attribute overview.



4
5
6
# File 'lib/tvdb_party/episode.rb', line 4

def overview
  @overview
end

#season_numberObject

Returns the value of attribute season_number.



4
5
6
# File 'lib/tvdb_party/episode.rb', line 4

def season_number
  @season_number
end

#thumbObject

Returns the value of attribute thumb.



4
5
6
# File 'lib/tvdb_party/episode.rb', line 4

def thumb
  @thumb
end

#writerObject

Returns the value of attribute writer.



4
5
6
# File 'lib/tvdb_party/episode.rb', line 4

def writer
  @writer
end

Instance Method Details

#seriesObject



30
31
32
# File 'lib/tvdb_party/episode.rb', line 30

def series
  client.get_series_by_id(@series_id)
end