Module: Traktr::Show::Season

Includes:
HTTParty
Defined in:
lib/traktr/show/season.rb

Class Method Summary collapse

Class Method Details

.library(show, season) ⇒ Object

show-season POST methods

Raises:

  • (ResponseError)


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/traktr/show/season.rb', line 10

def self.library(show, season)
  data = {
      username: Traktr.username, password: Traktr.password,
      title: show.title, year: show.year, imdb_id: show.imdb_id, tvdb_id: show.tvdb_id,
      season: season
  }
  response = self.post("/" + File.join("library", Traktr.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
  raise ResponseError.new(response) if response.code != 200

  Mash.new(response.parsed_response)
end

.seen(show, season) ⇒ Object

Raises:

  • (ResponseError)


22
23
24
25
26
27
28
29
30
31
32
# File 'lib/traktr/show/season.rb', line 22

def self.seen(show, season)
  data = {
      username: Traktr.username, password: Traktr.password,
      title: show.title, year: show.year, imdb_id: show.imdb_id, tvdb_id: show.tvdb_id,
      season: season
  }
  response = self.post("/" + File.join("seen", Traktr.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
  raise ResponseError.new(response) if response.code != 200

  Mash.new(response.parsed_response)
end