Class: TvdbPartyV2::Episode

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Episode.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/tvdb_party_v2/episode.rb', line 7

def initialize(client, options = {})
  @client = client
  @id = options["id"]
  @season_number = options["airedSeason"]
  @number = options["airedEpisodeNumber"]
  @name = options["episodeName"]
  @overview = options["overview"]
  @thumb = "http://www.thetvdb.com/banners/" + options["filename"] unless options["filename"].nil?
  @director = options["directors"]
  @writer = options["writers"]
  @series_id = options["seriesId"]
  @season_id = options["airedSeasonID"]
  @imdb_id = options["imdbId"]
  if options["guestStars"]
    @guest_stars = options["guestStars"]
  else
    @guest_stars = []
  end

  begin
    @air_date = Time.parse(options["firstAired"]).to_i
  rescue
    @air_date = 0
  end

  if options["siteRating"] && options["siteRating"] > 0
    @rating = options["siteRating"].to_f
  else
    @rating = 0
  end

  if options["siteRatingCount"] && options["siteRatingCount"] > 0
    @ratingcount = options["siteRatingCount"]
  else
    @ratingcount = 0
  end

end

Instance Attribute Details

#air_dateObject

Returns the value of attribute air_date.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def air_date
  @air_date
end

#clientObject (readonly)

Returns the value of attribute client.



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

def client
  @client
end

#directorObject

Returns the value of attribute director.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def director
  @director
end

#guest_starsObject

Returns the value of attribute guest_stars.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def guest_stars
  @guest_stars
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def id
  @id
end

#imdb_idObject

Returns the value of attribute imdb_id.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def imdb_id
  @imdb_id
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def name
  @name
end

#numberObject

Returns the value of attribute number.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def number
  @number
end

#overviewObject

Returns the value of attribute overview.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def overview
  @overview
end

#ratingObject

Returns the value of attribute rating.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def rating
  @rating
end

#ratingcountObject

Returns the value of attribute ratingcount.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def ratingcount
  @ratingcount
end

#season_idObject

Returns the value of attribute season_id.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def season_id
  @season_id
end

#season_numberObject

Returns the value of attribute season_number.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def season_number
  @season_number
end

#thumbObject

Returns the value of attribute thumb.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def thumb
  @thumb
end

#writerObject

Returns the value of attribute writer.



5
6
7
# File 'lib/tvdb_party_v2/episode.rb', line 5

def writer
  @writer
end

Instance Method Details

#seriesObject



46
47
48
# File 'lib/tvdb_party_v2/episode.rb', line 46

def series
  client.get_series_by_id(@series.id)
end