Class: TvRage::Api::Show

Inherits:
Base::Api::Show show all
Defined in:
lib/tv_rage/show.rb

Instance Attribute Summary

Attributes inherited from Base::Api::Show

#xml_doc

Instance Method Summary collapse

Methods inherited from Base::Api::Show

#==, #actors, #air_dates, #attributes, find, #initialize, #language, #name, #overview, #remote_ids, search_xml_document, search_xml_string, #to_s, xml_document, xml_string

Methods included from Helpers

#get_remote_file_as_string, #parsable_date?, #safely_parse_date

Constructor Details

This class inherits a constructor from Base::Api::Show

Instance Method Details

#aliasesObject



48
49
50
51
52
53
54
# File 'lib/tv_rage/show.rb', line 48

def aliases
  xml_doc.xpath('//akas/aka').collect do |aka|
    if country = aka.attr("country")
      [country.upcase.to_sym, aka.content.strip]
    end
  end.reject { |a| a.nil? }
end

#classificationObject



36
37
38
# File 'lib/tv_rage/show.rb', line 36

def classification
  xpath('//classification').try(:downcase).try(:to_sym)
end

#countryObject



22
23
24
# File 'lib/tv_rage/show.rb', line 22

def country
  xml_doc.xpath('//network').try(:attr, "country").try(:value)
end

#genresObject



30
31
32
33
34
# File 'lib/tv_rage/show.rb', line 30

def genres
  xml_doc.xpath('//genres/genre').collect do |genre|
    genre.content.strip
  end.reject { |g| g.nil? }
end

#networkObject



40
41
42
# File 'lib/tv_rage/show.rb', line 40

def network
  xpath('//network')
end

#network_idObject



26
27
28
# File 'lib/tv_rage/show.rb', line 26

def network_id
  xpath('//showid').try(:to_i)
end

#original_nameObject



10
11
12
# File 'lib/tv_rage/show.rb', line 10

def original_name
  xpath('//showname')
end

#runtimeObject



44
45
46
# File 'lib/tv_rage/show.rb', line 44

def runtime
  xpath('//runtime').try(:to_i).try(:*, 60)
end

#startedObject



14
15
16
# File 'lib/tv_rage/show.rb', line 14

def started
  xpath('//started').try(:to_i)
end

#statusObject



18
19
20
# File 'lib/tv_rage/show.rb', line 18

def status
  xpath('//status').try(:downcase).try(:gsub, /\W/, '_').try(:to_sym)
end