Class: MyShows::Show
- Inherits:
-
Hashie::Mash
- Object
- Hashie::Mash
- MyShows::Show
- Defined in:
- lib/my_shows/show.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*attrs) ⇒ Show
constructor
A new instance of Show.
Constructor Details
#initialize(*attrs) ⇒ Show
Returns a new instance of Show.
14 15 16 17 |
# File 'lib/my_shows/show.rb', line 14 def initialize *attrs super attrs.last[:episode].show = self if attrs.last && attrs.last[:episode] end |
Class Method Details
.client ⇒ Object
6 7 8 |
# File 'lib/my_shows/show.rb', line 6 def self.client @client ||= SidereelClient.new ENV["SIDEREEL_USERNAME"], ENV["SIDEREEL_PASSWORD"] end |
.client=(client) ⇒ Object
10 11 12 |
# File 'lib/my_shows/show.rb', line 10 def self.client= client @client = client end |
.next_episodes ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/my_shows/show.rb', line 19 def self.next_episodes client.tracked_tv_shows.first[1].map(&:tv_show).reject do |show| MyShows.logger.debug "TV Show data: #{show.inspect}" show.next_episode.nil? || show.next_episode.is_upcoming end.map do |show| episode = MyShows::Episode.new(season: show.next_episode.season_number, episode: show.next_episode.season_ordinal) Show.new name: show.complete_name, episode: episode end end |