Class: MyShows::Episode
Overview
Provides such methods: title episode_number season_number short_name air_date sequence_number production_number image tvrage_link
Instance Attribute Summary collapse
-
#show ⇒ Object
readonly
Returns the value of attribute show.
Attributes inherited from Item
Instance Method Summary collapse
-
#check! ⇒ Object
Check episode as ‘watched’, requires authorization via Profile.
-
#initialize(id, data, show) ⇒ Episode
constructor
A new instance of Episode.
- #to_s ⇒ Object
-
#uncheck! ⇒ Object
Check episode as ‘unwatched’, requires authorization via Profile.
Methods inherited from Item
Constructor Details
#initialize(id, data, show) ⇒ Episode
Returns a new instance of Episode.
17 18 19 20 21 22 23 24 25 |
# File 'lib/myshows/episode.rb', line 17 def initialize(id, data, show) super(id, data) @show = show [:id, :show, :title, :season_number, :episode_number].each do |f| raise ArgumentError.new("#{f} could not be nil") if send(f).nil? end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class MyShows::Item
Instance Attribute Details
#show ⇒ Object (readonly)
Returns the value of attribute show.
15 16 17 |
# File 'lib/myshows/episode.rb', line 15 def show @show end |
Instance Method Details
#check! ⇒ Object
Check episode as ‘watched’, requires authorization via Profile
33 34 35 |
# File 'lib/myshows/episode.rb', line 33 def check! @api.check_episode self end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/myshows/episode.rb', line 27 def to_s "#{show} - #{season_number}x#{episode_number} - #{title}" end |
#uncheck! ⇒ Object
Check episode as ‘unwatched’, requires authorization via Profile
39 40 41 |
# File 'lib/myshows/episode.rb', line 39 def uncheck! @api.uncheck_episode self end |