Class: TvdbPartyV2::Series

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Series.



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
# File 'lib/tvdb_party_v2/series.rb', line 8

def initialize(client, options = {})
  @client = client
  @id = options["id"]
  @name = options["seriesName"]
  @overview = options["overview"]
  @network = options["network"]
  @runtime = options["runtime"]
  @air_time = options['airsTime'] if options['airsTime']
  @imdb_id = options["imdbId"]
  @status = options["status"] if options["status"]
  @airs_dayofweek = options["airsDayOfWeek"]

  if options["genre"]
    @genres = options["genre"]
  else
    @genres = []
  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"].to_f
  else
    @ratingcount = 0
  end

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

Instance Attribute Details

#actorsObject

Returns the value of attribute actors.



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

def actors
  @actors
end

#air_timeObject

Returns the value of attribute air_time.



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

def air_time
  @air_time
end

#airs_dayofweekObject

Returns the value of attribute airs_dayofweek.



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

def airs_dayofweek
  @airs_dayofweek
end

#bannersObject

Returns the value of attribute banners.



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

def banners
  @banners
end

#clientObject (readonly)

Returns the value of attribute client.



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

def client
  @client
end

#first_airedObject

Returns the value of attribute first_aired.



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

def first_aired
  @first_aired
end

#genresObject

Returns the value of attribute genres.



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

def genres
  @genres
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#imdb_idObject

Returns the value of attribute imdb_id.



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

def imdb_id
  @imdb_id
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#networkObject

Returns the value of attribute network.



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

def network
  @network
end

#overviewObject

Returns the value of attribute overview.



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

def overview
  @overview
end

#ratingObject

Returns the value of attribute rating.



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

def rating
  @rating
end

#ratingcountObject

Returns the value of attribute ratingcount.



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

def ratingcount
  @ratingcount
end

#runtimeObject

Returns the value of attribute runtime.



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

def runtime
  @runtime
end

#seasonsObject

Returns the value of attribute seasons.



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

def seasons
  @seasons
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

Instance Method Details

#fanartObject



53
54
55
# File 'lib/tvdb_party_v2/series.rb', line 53

def fanart
  @banners_fanarts ||= client.get_banners(self, 'fanart')
end

#get_episode(season_number, episode_number) ⇒ Object



45
46
47
# File 'lib/tvdb_party_v2/series.rb', line 45

def get_episode(season_number, episode_number)
  client.get_episode(self, season_number, episode_number)
end

#postersObject



49
50
51
# File 'lib/tvdb_party_v2/series.rb', line 49

def posters
  @banners_posters ||= client.get_banners(self, 'season')
end

#season(season_number) ⇒ Object



86
87
88
# File 'lib/tvdb_party_v2/series.rb', line 86

def season(season_number)
  @season ||= client.get_episode(self, season_number)
end

#season_posters(season_number) ⇒ Object



65
66
67
# File 'lib/tvdb_party_v2/series.rb', line 65

def season_posters(season_number)
  posters.select {|b| b.subkey == season_number.to_s}
end

#seasonwideObject



61
62
63
# File 'lib/tvdb_party_v2/series.rb', line 61

def seasonwide
  @banners_seasonwide ||= client.get_banners(self, 'seasonwide')
end

#seasonwide_posters(season_number) ⇒ Object



69
70
71
# File 'lib/tvdb_party_v2/series.rb', line 69

def seasonwide_posters(season_number)
  seasonwide.select {|b| b.subkey == season_number.to_s}
end

#series_bannersObject



57
58
59
# File 'lib/tvdb_party_v2/series.rb', line 57

def series_banners
  @banners_series ||= client.get_banners(self, 'series')
end