class Traktr::Show

Public Instance Methods

comments(title, type = :all) click to toggle source
# File lib/traktr/show.rb, line 3
def comments(title, type = :all)
  type = [:all, :shouts, :reviews].include?(type) ? type.to_s : ""
  parse_response self.class.get("/" + File.join("comments.json", @client.api_key, title, type))

end
episode() click to toggle source
# File lib/traktr/show.rb, line 74
def episode
  @episode ||= Traktr::Show::Episode.new(@client)
end
library(show) click to toggle source
# File lib/traktr/show.rb, line 47
def library(show)
  data = @auth.merge(show)
  parse_response self.class.post("/" + File.join("library", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
end
season(title = nil, season = nil) click to toggle source
# File lib/traktr/show.rb, line 14
def season(title = nil, season = nil)
  if title && season
    parse_response self.class.get("/" + File.join("season.json", @client.api_key, title, season.to_s), :basic_auth => @auth)
  elsif !title && !season
    @season ||= Traktr::Show::Season.new(@client)
  else
    raise ArgumentError.new("wrong number of arguments")
  end
end
seasons(title) click to toggle source
# File lib/traktr/show.rb, line 24
def seasons(title)
  parse_response self.class.get("/" + File.join("seasons.json", @client.api_key, title))
end
seen(show) click to toggle source
# File lib/traktr/show.rb, line 69
def seen(show)
  data = @auth.merge(show)
  parse_response self.class.post("/" + File.join("seen", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
end
stats(title) click to toggle source
# File lib/traktr/show.rb, line 28
def stats(title)
  parse_response self.class.get('/' + File.join('stats.json', @client.api_key, title))
end
summaries(titles, extended = nil) click to toggle source
# File lib/traktr/show.rb, line 37
def summaries(titles, extended = nil)
  titles   = titles.join(",") if titles.class == Array
  extended = [:normal, :full].include?(extended) ? extended.to_s : ""
  parse_response self.class.get("/" + File.join("summaries.json", @client.api_key, titles, extended))
end
summary(title, extended = nil) click to toggle source
# File lib/traktr/show.rb, line 32
def summary(title, extended = nil)
  extended = [:normal, :full].include?(extended) ? extended.to_s : ""
  parse_response self.class.get("/" + File.join("summary.json", @client.api_key, title, extended), :basic_auth => @auth)
end
unlibrary(show) click to toggle source
# File lib/traktr/show.rb, line 52
def unlibrary(show)
  data = @auth.merge(show)
  parse_response self.class.post("/" + File.join("unlibrary", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
end
unwatchlist(shows) click to toggle source
# File lib/traktr/show.rb, line 63
def unwatchlist(shows)
  shows = [ shows ] if shows.class != Array
  data = @auth.merge({ shows: shows })
  parse_response self.class.post("/" + File.join("unwatchlist", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
end
watchingnow(title) click to toggle source
# File lib/traktr/show.rb, line 43
def watchingnow(title)
  parse_response self.class.get("/" + File.join("watchingnow.json", @client.api_key, title), :basic_auth => @auth)
end
watchlist(shows) click to toggle source
# File lib/traktr/show.rb, line 57
def watchlist(shows)
  shows = [ shows ] if shows.class != Array
  data = @auth.merge({ shows: shows })
  parse_response self.class.post("/" + File.join("watchlist", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
end