Class: Bierdopje::Episode
Instance Attribute Summary collapse
-
#air_date ⇒ Object
Returns the value of attribute air_date.
-
#code ⇒ Object
Returns the value of attribute code.
-
#episode ⇒ Object
Returns the value of attribute episode.
-
#id ⇒ Object
Returns the value of attribute id.
-
#season ⇒ Object
Returns the value of attribute season.
-
#show_name ⇒ Object
Returns the value of attribute show_name.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
-
.find(id) ⇒ Object
Retrieve an Episode based on it’s id.
Instance Method Summary collapse
-
#initialize(doc) ⇒ Episode
constructor
A new instance of Episode.
-
#show ⇒ Object
Retrieve the Show this Episode belongs to.
-
#subtitles(language = :nl) ⇒ Object
Retrieve all Subtitles for this Episode.
Methods inherited from Base
Constructor Details
#initialize(doc) ⇒ Episode
Returns a new instance of Episode.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bierdopje/episode.rb', line 20 def initialize doc attributes = { :id => doc.at_xpath('episodeid').content, :season => doc.at_xpath('season').content, :episode => doc.at_xpath('episode').content, :code => doc.at_xpath('formatted').content, :title => doc.at_xpath('title').content, :summary => doc.at_xpath('summary').content, :air_date => doc.at_xpath('airdate').content, :show_name => doc.at_xpath('showlink').content.match(/^http:\/\/www\.bierdopje\.com\/shows\/(.*)$/)[1] } super attributes end |
Instance Attribute Details
#air_date ⇒ Object
Returns the value of attribute air_date.
3 4 5 |
# File 'lib/bierdopje/episode.rb', line 3 def air_date @air_date end |
#code ⇒ Object
Returns the value of attribute code.
3 4 5 |
# File 'lib/bierdopje/episode.rb', line 3 def code @code end |
#episode ⇒ Object
Returns the value of attribute episode.
3 4 5 |
# File 'lib/bierdopje/episode.rb', line 3 def episode @episode end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/bierdopje/episode.rb', line 3 def id @id end |
#season ⇒ Object
Returns the value of attribute season.
3 4 5 |
# File 'lib/bierdopje/episode.rb', line 3 def season @season end |
#show_name ⇒ Object
Returns the value of attribute show_name.
3 4 5 |
# File 'lib/bierdopje/episode.rb', line 3 def show_name @show_name end |
#summary ⇒ Object
Returns the value of attribute summary.
3 4 5 |
# File 'lib/bierdopje/episode.rb', line 3 def summary @summary end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/bierdopje/episode.rb', line 3 def title @title end |
Class Method Details
Instance Method Details
#show ⇒ Object
Retrieve the Show this Episode belongs to.
6 7 8 |
# File 'lib/bierdopje/episode.rb', line 6 def show Show.find_by_name show_name end |
#subtitles(language = :nl) ⇒ Object
Retrieve all Subtitles for this Episode. You can pass the language as an option. This either has to be :nl
(default) or :en
.
13 14 15 16 17 18 |
# File 'lib/bierdopje/episode.rb', line 13 def subtitles language=:nl response = fetch "GetAllSubsForEpisode/#{id}/#{language}" response.xpath('results/result').collect do |result| Subtitle.new(result) end end |