Class: TheTvdb::Episode
- Inherits:
-
Object
- Object
- TheTvdb::Episode
- Defined in:
- lib/the_tvdb/episode.rb
Instance Attribute Summary collapse
-
#absolute_number ⇒ Object
Returns the value of attribute absolute_number.
-
#aired_at ⇒ Object
Returns the value of attribute aired_at.
-
#description ⇒ Object
Returns the value of attribute description.
-
#director ⇒ Object
Returns the value of attribute director.
-
#dvd_chapter ⇒ Object
Returns the value of attribute dvd_chapter.
-
#dvd_disc ⇒ Object
Returns the value of attribute dvd_disc.
-
#dvd_episode_number ⇒ Object
Returns the value of attribute dvd_episode_number.
-
#dvd_season ⇒ Object
Returns the value of attribute dvd_season.
-
#guest_stars ⇒ Object
Returns the value of attribute guest_stars.
-
#image_url ⇒ Object
Returns the value of attribute image_url.
-
#imdb_id ⇒ Object
Returns the value of attribute imdb_id.
-
#language ⇒ Object
Returns the value of attribute language.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Object
Returns the value of attribute number.
-
#production_code ⇒ Object
Returns the value of attribute production_code.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#rating_count ⇒ Object
Returns the value of attribute rating_count.
-
#remote_id ⇒ Object
Returns the value of attribute remote_id.
-
#season_number ⇒ Object
Returns the value of attribute season_number.
-
#season_remote_id ⇒ Object
Returns the value of attribute season_remote_id.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#writer ⇒ Object
Returns the value of attribute writer.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(info) ⇒ Episode
constructor
A new instance of Episode.
- #to_hash ⇒ Object
Constructor Details
#initialize(info) ⇒ Episode
Returns a new instance of Episode.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/the_tvdb/episode.rb', line 8 def initialize(info) @remote_id = info['id'].to_i @season_remote_id = info['seasonid'].to_i @season_number = info['SeasonNumber'].to_i @name = info['EpisodeName'] @number = info['EpisodeNumber'].to_i @aired_at = info['FirstAired'] @description = info['Overview'] @guest_stars = info['GuestStars'].try(:to_tvdb_array) @director = info['Director'].try(:to_tvdb_array) @writer = info['Writer'].try(:to_tvdb_array) @updated_at = Time.at(info['lastupdated'].to_i) @dvd_disc = info['DVD_discid'] @dvd_season = info['DVD_season'] @dvd_episode_number = info['DVD_episodenumber'] @dvd_chapter = info['DVD_chapter'] @absolute_number = info['absolute_number'] @image_url = "#{TheTvdb.gateway.mirror}/banners/#{info['filename']}" unless info['filename'].nil? @imdb_id = info['IMDB_ID'] @language = info['Language'] @prodiction_code = info['ProductionCode'] @rating = info['Rating'].try(:to_f) @rating_count = info['RatingCount'].try(:to_i) end |
Instance Attribute Details
#absolute_number ⇒ Object
Returns the value of attribute absolute_number.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def absolute_number @absolute_number end |
#aired_at ⇒ Object
Returns the value of attribute aired_at.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def aired_at @aired_at end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def description @description end |
#director ⇒ Object
Returns the value of attribute director.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def director @director end |
#dvd_chapter ⇒ Object
Returns the value of attribute dvd_chapter.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def dvd_chapter @dvd_chapter end |
#dvd_disc ⇒ Object
Returns the value of attribute dvd_disc.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def dvd_disc @dvd_disc end |
#dvd_episode_number ⇒ Object
Returns the value of attribute dvd_episode_number.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def dvd_episode_number @dvd_episode_number end |
#dvd_season ⇒ Object
Returns the value of attribute dvd_season.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def dvd_season @dvd_season end |
#guest_stars ⇒ Object
Returns the value of attribute guest_stars.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def guest_stars @guest_stars end |
#image_url ⇒ Object
Returns the value of attribute image_url.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def image_url @image_url end |
#imdb_id ⇒ Object
Returns the value of attribute imdb_id.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def imdb_id @imdb_id end |
#language ⇒ Object
Returns the value of attribute language.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def language @language end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def number @number end |
#production_code ⇒ Object
Returns the value of attribute production_code.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def production_code @production_code end |
#rating ⇒ Object
Returns the value of attribute rating.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def @rating end |
#rating_count ⇒ Object
Returns the value of attribute rating_count.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def @rating_count end |
#remote_id ⇒ Object
Returns the value of attribute remote_id.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def remote_id @remote_id end |
#season_number ⇒ Object
Returns the value of attribute season_number.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def season_number @season_number end |
#season_remote_id ⇒ Object
Returns the value of attribute season_remote_id.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def season_remote_id @season_remote_id end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def updated_at @updated_at end |
#writer ⇒ Object
Returns the value of attribute writer.
4 5 6 |
# File 'lib/the_tvdb/episode.rb', line 4 def writer @writer end |
Class Method Details
Instance Method Details
#to_hash ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/the_tvdb/episode.rb', line 38 def to_hash { remote_id: @remote_id, name: @name, description: @description, season_remote_id: @season_remote_id, season_number: @season_number, number: @number, aired_at: @aired_at, guest_stars: @guest_stars, director: @director, writer: @writer, updated_at: @updated_at, dvd_disc: @dvd_disc, dvd_season: @dvd_season, dvd_episode_number: @dvd_episode_number, dvd_chapter: @dvd_chapter, absolute_number: @absolute_number, image_url: @image_url, imdb_id: @imdb_id, language: @language, production_code: @production_code, rating: @rating, rating_count: @rating_count } end |