Class: TheTvDb::Api::Episode
Instance Attribute Summary
#xml_doc
Instance Method Summary
collapse
#attributes, #initialize, #name, #network_ids, #to_s, #usable?
Methods included from Helpers
#get_remote_file_as_string, #parsable_date?, #safely_parse_date
Instance Method Details
#absolute_number ⇒ Object
49
50
51
52
|
# File 'lib/the_tv_db/api/episode.rb', line 49
def absolute_number
an = xpath('.//absolute_number')
an.blank? ? nil : an
end
|
#air_dates ⇒ Object
37
38
39
|
# File 'lib/the_tv_db/api/episode.rb', line 37
def air_dates
[ Date.parse(xpath('.//FirstAired'))] rescue []
end
|
#banner_path ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/the_tv_db/api/episode.rb', line 41
def banner_path
if (e = xpath('.//EpImgFlag').try(:to_i)) && e <= 2 && i = xpath('.//filename')
return "#{TheTvDb::Api::Mirrors.all.first}/banners/#{i}" unless i.blank?
end
end
|
#network_id ⇒ Object
5
6
7
|
# File 'lib/the_tv_db/api/episode.rb', line 5
def network_id
xpath('.//id').try(:to_i)
end
|
14
15
16
|
# File 'lib/the_tv_db/api/episode.rb', line 14
def number
xpath('.//EpisodeNumber').try(:to_i)
end
|
#number_of_ratings ⇒ Object
33
34
35
|
# File 'lib/the_tv_db/api/episode.rb', line 33
def number_of_ratings
xpath('.//RatingCount').try(:to_i)
end
|
#original_name ⇒ Object
22
23
24
|
# File 'lib/the_tv_db/api/episode.rb', line 22
def original_name
xpath('.//EpisodeName')
end
|
18
19
20
|
# File 'lib/the_tv_db/api/episode.rb', line 18
def overview
xpath('.//Overview')
end
|
26
27
28
29
30
31
|
# File 'lib/the_tv_db/api/episode.rb', line 26
def rating
r = xpath('.//Rating')
if r.to_f > 0
return (r.to_f * 10).to_i
end
end
|
#season_number ⇒ Object
9
10
11
12
|
# File 'lib/the_tv_db/api/episode.rb', line 9
def season_number
sn = xpath('.//SeasonNumber').try(:to_i)
(sn.nil? || sn == 0) ? nil : sn
end
|