Class: Mediaman::Trakt::TVEpisode

Inherits:
Fetcher
  • Object
show all
Defined in:
lib/mediaman/trakt.rb

Instance Attribute Summary collapse

Attributes inherited from Fetcher

#options, #response

Instance Method Summary collapse

Methods inherited from Fetcher

from_hash, #initialize

Constructor Details

This class inherits a constructor from Mediaman::Trakt::Fetcher

Instance Attribute Details

#showObject

Returns the value of attribute show.



49
50
51
# File 'lib/mediaman/trakt.rb', line 49

def show
  @show
end

Instance Method Details

#fetch!Object



51
52
53
54
55
56
# File 'lib/mediaman/trakt.rb', line 51

def fetch!
  url = "http://api.trakt.tv/show/episode/summary.json/#{Trakt.api_key}/#{slug}"
  self.response = r = self.class.get(url)
  self.show = Trakt::TVShow.from_hash self.response['show']
  self.response['episode']
end

#slugObject



58
59
60
# File 'lib/mediaman/trakt.rb', line 58

def slug
  options[:slug].presence || "#{title_slug}/#{options[:season_number]}/#{options[:episode_number]}"
end

#title_slugObject



62
63
64
# File 'lib/mediaman/trakt.rb', line 62

def title_slug
  options[:title_slug].presence || "#{options[:show_title].parameterize}"
end