Class: TVDB::Episode

Inherits:
Object
  • Object
show all
Defined in:
lib/tvdb-rb/episode.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, xml) ⇒ Episode

Returns a new instance of Episode.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tvdb-rb/episode.rb', line 7

def initialize client, xml
  @client = client
  # @raw_rsp = xml
  @tvdb_id  = xml.xpath("id").text
  @episode_name = xml.xpath("EpisodeName").text
  @episode_number = xml.xpath("EpisodeNumber").text
  @first_aired = xml.xpath("FirstAired").text
  @guest_stars = to_array xml.xpath("GuestStars").text
  @imbdb_id = xml.xpath("IMDB_ID").text
  @language = xml.xpath("Language").text
  @overview = xml.xpath("Overview").text
  @production_code = xml.xpath("ProductionCode").text
  @rating = xml.xpath("Rating").text
  @rating_count = xml.xpath("RatingCount").text
  @season_number = xml.xpath("SeasonNumber").text
  @writers = to_array xml.xpath("Writer").text
  @directors = to_array xml.xpath("Director").text
  @season_id = xml.xpath("seasonid").text
  @series_id = xml.xpath("seriesid").text
end

Instance Attribute Details

#directorObject

Returns the value of attribute director.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def director
  @director
end

#episode_nameObject

Returns the value of attribute episode_name.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def episode_name
  @episode_name
end

#episode_numberObject

Returns the value of attribute episode_number.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def episode_number
  @episode_number
end

#first_airedObject

Returns the value of attribute first_aired.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def first_aired
  @first_aired
end

#guest_starsObject

Returns the value of attribute guest_stars.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def guest_stars
  @guest_stars
end

#imdb_idObject

Returns the value of attribute imdb_id.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def imdb_id
  @imdb_id
end

#languageObject

Returns the value of attribute language.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def language
  @language
end

#overviewObject

Returns the value of attribute overview.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def overview
  @overview
end

#production_codeObject

Returns the value of attribute production_code.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def production_code
  @production_code
end

#ratingObject

Returns the value of attribute rating.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def rating
  @rating
end

#rating_countObject

Returns the value of attribute rating_count.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def rating_count
  @rating_count
end

#season_numberObject

Returns the value of attribute season_number.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def season_number
  @season_number
end

#series_idObject

Returns the value of attribute series_id.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def series_id
  @series_id
end

#tvdb_idObject

Returns the value of attribute tvdb_id.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def tvdb_id
  @tvdb_id
end

#writersObject

Returns the value of attribute writers.



5
6
7
# File 'lib/tvdb-rb/episode.rb', line 5

def writers
  @writers
end

Instance Method Details

#to_array(string) ⇒ Object



28
29
30
# File 'lib/tvdb-rb/episode.rb', line 28

def to_array string
  string.split("|").reject! { |c| c.empty? }
end