Class: MyShows::Show
Overview
Provides such methods: title ru_title rating country started ended runtime voted year genres status watching imdb_id tvrage_id kinopoisk_id
Instance Attribute Summary
Attributes inherited from Item
Instance Method Summary collapse
-
#episode(*args) ⇒ Object
Returns episode by title (smart search) or by season and episode number.
-
#episodes ⇒ Object
Returns all episodes.
-
#initialize(id, data) ⇒ Show
constructor
A new instance of Show.
- #to_s ⇒ Object
Methods inherited from Item
Constructor Details
#initialize(id, data) ⇒ Show
Returns a new instance of Show.
23 24 25 26 27 28 29 |
# File 'lib/myshows/show.rb', line 23 def initialize(id, data) super(id, data) [:id, :title].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 Method Details
#episode(*args) ⇒ Object
Returns episode by title (smart search) or by season and episode number
41 42 43 44 45 46 47 |
# File 'lib/myshows/show.rb', line 41 def episode(*args) if args.first.is_a? String episode_by_title *args else episode_by_numbers *args end end |
#episodes ⇒ Object
Returns all episodes
36 37 38 |
# File 'lib/myshows/show.rb', line 36 def episodes @api.show_episodes self end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/myshows/show.rb', line 31 def to_s title end |