Class: Traktr::Show::Season

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/traktr/show/season.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Season

Returns a new instance of Season.



7
8
9
# File 'lib/traktr/show/season.rb', line 7

def initialize(client)
  @client = client
end

Instance Method Details

#library(show, season) ⇒ Object

show-season POST methods

Raises:

  • (ResponseError)


14
15
16
17
18
19
20
21
22
23
24
# File 'lib/traktr/show/season.rb', line 14

def library(show, season)
  data = {
      username: @client.username, password: @client.password,
      title: show.title, year: show.year, imdb_id: show.imdb_id, tvdb_id: show.tvdb_id,
      season: season
  }
  response = self.class.post("/" + File.join("library", @client.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)


26
27
28
29
30
31
32
33
34
35
36
# File 'lib/traktr/show/season.rb', line 26

def seen(show, season)
  data = {
      username: @client.username, password: @client.password,
      title: show.title, year: show.year, imdb_id: show.imdb_id, tvdb_id: show.tvdb_id,
      season: season
  }
  response = self.class.post("/" + File.join("seen", @client.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