Class: Bierdopje::Subtitle
Instance Attribute Summary collapse
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#file_size ⇒ Object
Returns the value of attribute file_size.
-
#link ⇒ Object
Returns the value of attribute link.
-
#uploaded_at ⇒ Object
Returns the value of attribute uploaded_at.
Class Method Summary collapse
-
.find(show_id, season_number, episode_number, language = :nl) ⇒ Object
Retrieve a Subtitle based on Show id, season number and episode number.
Instance Method Summary collapse
-
#initialize(doc) ⇒ Subtitle
constructor
A new instance of Subtitle.
Methods inherited from Base
Constructor Details
#initialize(doc) ⇒ Subtitle
Returns a new instance of Subtitle.
5 6 7 8 9 10 11 12 13 |
# File 'lib/bierdopje/subtitle.rb', line 5 def initialize doc attributes = { :file_name => doc.at_xpath('filename').content, :file_size => doc.at_xpath('filesize').content, :uploaded_at => doc.at_xpath('pubdate').content, :link => doc.at_xpath('downloadlink').content } super attributes end |
Instance Attribute Details
#file_name ⇒ Object
Returns the value of attribute file_name.
3 4 5 |
# File 'lib/bierdopje/subtitle.rb', line 3 def file_name @file_name end |
#file_size ⇒ Object
Returns the value of attribute file_size.
3 4 5 |
# File 'lib/bierdopje/subtitle.rb', line 3 def file_size @file_size end |
#link ⇒ Object
Returns the value of attribute link.
3 4 5 |
# File 'lib/bierdopje/subtitle.rb', line 3 def link @link end |
#uploaded_at ⇒ Object
Returns the value of attribute uploaded_at.
3 4 5 |
# File 'lib/bierdopje/subtitle.rb', line 3 def uploaded_at @uploaded_at end |
Class Method Details
.find(show_id, season_number, episode_number, language = :nl) ⇒ Object
Retrieve a Subtitle based on Show id, season number and episode number. You can pass the language as an option. This either has to be :nl
(default) or :en
.
19 20 21 22 23 24 |
# File 'lib/bierdopje/subtitle.rb', line 19 def find show_id, season_number, episode_number, language=:nl response = fetch "GetAllSubsFor/#{show_id}/#{season_number}/#{episode_number}/#{language}" response.xpath('results/result').collect do |result| Subtitle.new(result) end end |