Class: P3::Tvdb::Series
- Inherits:
-
Object
- Object
- P3::Tvdb::Series
- Defined in:
- lib/p3-tvdb/series.rb
Instance Attribute Summary collapse
-
#actors ⇒ Object
Returns the value of attribute actors.
-
#air_time ⇒ Object
Returns the value of attribute air_time.
-
#banners ⇒ Object
Returns the value of attribute banners.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#content_rating ⇒ Object
Returns the value of attribute content_rating.
-
#first_aired ⇒ Object
Returns the value of attribute first_aired.
-
#genres ⇒ Object
Returns the value of attribute genres.
-
#id ⇒ Object
Returns the value of attribute id.
-
#imdb_id ⇒ Object
Returns the value of attribute imdb_id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#network ⇒ Object
Returns the value of attribute network.
-
#overview ⇒ Object
Returns the value of attribute overview.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#rating_count ⇒ Object
Returns the value of attribute rating_count.
-
#runtime ⇒ Object
Returns the value of attribute runtime.
-
#seasons ⇒ Object
Returns the value of attribute seasons.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #episodes ⇒ Object
- #fanart(language) ⇒ Object
- #get_episode(season_number, episode_number) ⇒ Object
-
#initialize(client, options = {}) ⇒ Series
constructor
A new instance of Series.
- #posters(language) ⇒ Object
- #season(season_number) ⇒ Object
- #season_posters(season_number, language) ⇒ Object
- #seasonwide_posters(season_number, language) ⇒ Object
- #series_banners(language) ⇒ Object
- #to_h ⇒ Object
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 |
# File 'lib/p3-tvdb/series.rb', line 8 def initialize(client, ={}) @client = client @id = ["id"] @name = ["SeriesName"] @overview = ["Overview"] @network = ["Network"] @runtime = ["Runtime"] @air_time = ['Airs_Time'] if ['Airs_Time'] @imdb_id = ["IMDB_ID"] @content_rating = ["ContentRating"] @status = ["Status"] if ["Genre"] @genres = ["Genre"][1..-1].split("|") else @genres = [] end if ["Rating"] && ["Rating"].size > 0 @rating = ["Rating"].to_f else @rating = 0 end if ["RatingCount"] && ["RatingCount"].size > 0 @rating_count = ["RatingCount"].to_f else @rating_count = 0 end begin @first_aired = Date.parse(["FirstAired"]) rescue end end |
Instance Attribute Details
#actors ⇒ Object
Returns the value of attribute actors.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def actors @actors end |
#air_time ⇒ Object
Returns the value of attribute air_time.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def air_time @air_time end |
#banners ⇒ Object
Returns the value of attribute banners.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def @banners end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
4 5 6 |
# File 'lib/p3-tvdb/series.rb', line 4 def client @client end |
#content_rating ⇒ Object
Returns the value of attribute content_rating.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def @content_rating end |
#first_aired ⇒ Object
Returns the value of attribute first_aired.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def first_aired @first_aired end |
#genres ⇒ Object
Returns the value of attribute genres.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def genres @genres end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def id @id end |
#imdb_id ⇒ Object
Returns the value of attribute imdb_id.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def imdb_id @imdb_id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def name @name end |
#network ⇒ Object
Returns the value of attribute network.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def network @network end |
#overview ⇒ Object
Returns the value of attribute overview.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def overview @overview end |
#rating ⇒ Object
Returns the value of attribute rating.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def @rating end |
#rating_count ⇒ Object
Returns the value of attribute rating_count.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def @rating_count end |
#runtime ⇒ Object
Returns the value of attribute runtime.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def runtime @runtime end |
#seasons ⇒ Object
Returns the value of attribute seasons.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def seasons @seasons end |
#status ⇒ Object
Returns the value of attribute status.
5 6 7 |
# File 'lib/p3-tvdb/series.rb', line 5 def status @status end |
Instance Method Details
#episodes ⇒ Object
76 77 78 |
# File 'lib/p3-tvdb/series.rb', line 76 def episodes @episodes ||= client.get_all_episodes(self) end |
#fanart(language) ⇒ Object
52 53 54 |
# File 'lib/p3-tvdb/series.rb', line 52 def fanart(language) .select{|b| b. == 'fanart' && b.language == language} end |
#get_episode(season_number, episode_number) ⇒ Object
44 45 46 |
# File 'lib/p3-tvdb/series.rb', line 44 def get_episode(season_number, episode_number) client.get_episode(self, season_number, episode_number) end |
#posters(language) ⇒ Object
48 49 50 |
# File 'lib/p3-tvdb/series.rb', line 48 def posters(language) .select{|b| b. == 'poster' && b.language == language} end |
#season(season_number) ⇒ Object
84 85 86 |
# File 'lib/p3-tvdb/series.rb', line 84 def season(season_number) seasons.detect{|s| s.number == season_number} end |
#season_posters(season_number, language) ⇒ Object
60 61 62 |
# File 'lib/p3-tvdb/series.rb', line 60 def season_posters(season_number, language) .select{|b| b. == 'season' && b. == 'season' && b.season == season_number.to_s && b.language == language} end |
#seasonwide_posters(season_number, language) ⇒ Object
64 65 66 |
# File 'lib/p3-tvdb/series.rb', line 64 def seasonwide_posters(season_number, language) .select{|b| b. == 'season' && b. == 'seasonwide' && b.season == season_number.to_s && b.language == language} end |
#series_banners(language) ⇒ Object
56 57 58 |
# File 'lib/p3-tvdb/series.rb', line 56 def (language) .select{|b| b. == 'series' && b.language == language} end |
#to_h ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/p3-tvdb/series.rb', line 88 def to_h hash = {} self.instance_variables.each do | var | #turn episode object into hash v = self.instance_variable_get( var ) hash[ var.to_s.gsub('@','').to_sym ] = v end hash.delete(:client) hash.delete(:banners) return hash end |