Class: MyShows::Show

Inherits:
Item
  • Object
show all
Defined in:
lib/myshows/show.rb

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

#id

Instance Method Summary collapse

Methods inherited from Item

#==, #method_missing

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

#episodesObject

Returns all episodes



36
37
38
# File 'lib/myshows/show.rb', line 36

def episodes
  @api.show_episodes self
end

#to_sObject



31
32
33
# File 'lib/myshows/show.rb', line 31

def to_s
  title
end