Class: TheTvdb::Show
- Inherits:
-
Object
- Object
- TheTvdb::Show
- Defined in:
- lib/the_tvdb/show.rb
Instance Attribute Summary collapse
-
#actors ⇒ Object
Returns the value of attribute actors.
-
#added_at ⇒ Object
Returns the value of attribute added_at.
-
#airs_day_of_week ⇒ Object
Returns the value of attribute airs_day_of_week.
-
#airs_time ⇒ Object
Returns the value of attribute airs_time.
-
#banner ⇒ Object
Returns the value of attribute banner.
-
#content_rating ⇒ Object
Returns the value of attribute content_rating.
-
#description ⇒ Object
Returns the value of attribute description.
-
#episodes ⇒ Object
Returns the value of attribute episodes.
-
#fanart ⇒ Object
Returns the value of attribute fanart.
-
#first_aired ⇒ Object
Returns the value of attribute first_aired.
-
#genre ⇒ Object
Returns the value of attribute genre.
-
#imdb_id ⇒ Object
Returns the value of attribute imdb_id.
-
#language ⇒ Object
Returns the value of attribute language.
-
#last_updated ⇒ Object
Returns the value of attribute last_updated.
-
#name ⇒ Object
Returns the value of attribute name.
-
#network ⇒ Object
Returns the value of attribute network.
-
#poster ⇒ Object
Returns the value of attribute poster.
-
#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.
-
#runtime ⇒ Object
Returns the value of attribute runtime.
-
#status ⇒ Object
Returns the value of attribute status.
-
#zap2it_id ⇒ Object
Returns the value of attribute zap2it_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(info, partial = false) ⇒ Show
constructor
A new instance of Show.
- #to_hash ⇒ Object
Constructor Details
#initialize(info, partial = false) ⇒ Show
Returns a new instance of Show.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/the_tvdb/show.rb', line 26 def initialize(info, partial=false) @remote_id = info['id'].to_i @name = info['SeriesName'] @banner = "#{TheTvdb.gateway.mirror}/banners/#{info['banner']}" unless info['banner'].nil? @description = info['Overview'] @imdb_id = info['IMDB_ID'] @zap2it_id = info['zap2it_id'] @first_aired = info['FirstAired'] @language = info['language'] unless partial @episodes = [] @actors = info['Actors'].try(:to_tvdb_array) @airs_day_of_week = info['Airs_DayOfWeek'] @airs_time = info['Airs_Time'] @content_rating = info['ContentRating'] @genre = info['Genre'].try(:to_tvdb_array) @network = info['Network'] @runtime = info['Runtime'].try(:to_i) @fanart = "#{TheTvdb.gateway.mirror}/banners/#{info['fanart']}" unless info['fanart'].nil? @rating = info['Rating'].try(:to_f) @rating_count = info['RatingCount'].try(:to_i) @status = info['Status'] @added_at = info['added'] @last_updated = info['lastupdated'] @poster = "#{TheTvdb.gateway.mirror}/banners/#{info['poster']}" unless info['poster'].nil? end end |
Instance Attribute Details
#actors ⇒ Object
Returns the value of attribute actors.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def actors @actors end |
#added_at ⇒ Object
Returns the value of attribute added_at.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def added_at @added_at end |
#airs_day_of_week ⇒ Object
Returns the value of attribute airs_day_of_week.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def airs_day_of_week @airs_day_of_week end |
#airs_time ⇒ Object
Returns the value of attribute airs_time.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def airs_time @airs_time end |
#banner ⇒ Object
Returns the value of attribute banner.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def @banner end |
#content_rating ⇒ Object
Returns the value of attribute content_rating.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def @content_rating end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def description @description end |
#episodes ⇒ Object
Returns the value of attribute episodes.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def episodes @episodes end |
#fanart ⇒ Object
Returns the value of attribute fanart.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def fanart @fanart end |
#first_aired ⇒ Object
Returns the value of attribute first_aired.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def first_aired @first_aired end |
#genre ⇒ Object
Returns the value of attribute genre.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def genre @genre end |
#imdb_id ⇒ Object
Returns the value of attribute imdb_id.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def imdb_id @imdb_id end |
#language ⇒ Object
Returns the value of attribute language.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def language @language end |
#last_updated ⇒ Object
Returns the value of attribute last_updated.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def last_updated @last_updated end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def name @name end |
#network ⇒ Object
Returns the value of attribute network.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def network @network end |
#poster ⇒ Object
Returns the value of attribute poster.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def poster @poster end |
#rating ⇒ Object
Returns the value of attribute rating.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def @rating end |
#rating_count ⇒ Object
Returns the value of attribute rating_count.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def @rating_count end |
#remote_id ⇒ Object
Returns the value of attribute remote_id.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def remote_id @remote_id end |
#runtime ⇒ Object
Returns the value of attribute runtime.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def runtime @runtime end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def status @status end |
#zap2it_id ⇒ Object
Returns the value of attribute zap2it_id.
4 5 6 |
# File 'lib/the_tvdb/show.rb', line 4 def zap2it_id @zap2it_id end |
Class Method Details
.find(remote_id) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/the_tvdb/show.rb', line 14 def self.find(remote_id) begin info = TheTvdb.gateway.get_series_package(remote_id) show = self.new(info['Series']) show.episodes = info['Episode'].blank? ? [] : [ info['Episode'] ].flatten.map {|e| TheTvdb::Episode.new(e) } show rescue puts 'There was an issue with the series you tried to fetch' nil end end |
Instance Method Details
#to_hash ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/the_tvdb/show.rb', line 56 def to_hash { remote_id: @remote_id, name: @name, banner: @banner, description: @description, first_aired: @first_aired, imdb_id: @imdb_id, zap2it_id: @zap2it_id, language: @language, actors: @actors, airs_day_of_week: @airs_day_of_week, airs_time: @airs_time, content_rating: @content_rating, genre: @genre, network: @network, runtime: @runtime, fanart: @fanart, rating: @rating, rating_count: @rating_count, status: @status, added_at: @added_at, last_updated: @last_updated, poster: @poster } end |