Class: MyShows::Profile
- Inherits:
-
Object
- Object
- MyShows::Profile
- Defined in:
- lib/myshows/profile.rb
Overview
Profile initialization is needed to gain access to some functions of API
Instance Method Summary collapse
-
#initialize(login, password_md5) ⇒ Profile
constructor
Login and md5-hashed password of valid account on myshows.ru.
-
#show(title) ⇒ Object
Smart search of one of user shows by title.
-
#shows ⇒ Object
All active, delayed and cancelled shows of current user.
Constructor Details
Instance Method Details
#show(title) ⇒ Object
Smart search of one of user shows by title
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/myshows/profile.rb', line 24 def show(title) found = shows.values_at *matcher.match(title) case found.count when 0 raise MyShows::Error.new "show with title \"#{title}\" was not found" when 1 found.first else raise MyShows::Error.new "ambiguous title \"#{title}\" corresponds to shows #{found.map {|s| %Q["#{s}"]} * ', '}" end end |
#shows ⇒ Object
All active, delayed and cancelled shows of current user
19 20 21 |
# File 'lib/myshows/profile.rb', line 19 def shows @api.user_shows end |