Module: Traktr::User::Library::Shows

Includes:
HTTParty
Defined in:
lib/traktr/user/library/shows.rb

Instance Method Summary collapse

Instance Method Details

#all(username = @client.username, extended = :min) ⇒ Object

Raises:

  • (ResponseError)


8
9
10
11
12
13
14
15
# File 'lib/traktr/user/library/shows.rb', line 8

def all(username = @client.username, extended = :min)
  response = self.class.get('/' + File.join('all.json', @client.api_key, username, extended.to_s))
  raise ResponseError.new(response) if response.code != 200

  response.parsed_response.collect do |item|
    Mash.new(item)
  end
end

#collection(username = @client.username, extended = :min) ⇒ Object

Raises:

  • (ResponseError)


17
18
19
20
21
22
23
24
# File 'lib/traktr/user/library/shows.rb', line 17

def collection(username = @client.username, extended = :min)
  response = self.class.get('/' + File.join('collection.json', @client.api_key, username, extended.to_s))
  raise ResponseError.new(response) if response.code != 200

  response.parsed_response.collect do |item|
    Mash.new(item)
  end
end

#watched(username = @client.username, extended = :min) ⇒ Object

Raises:

  • (ResponseError)


26
27
28
29
30
31
32
33
# File 'lib/traktr/user/library/shows.rb', line 26

def watched(username = @client.username, extended = :min)
  response = self.class.get('/' + File.join('watched.json', @client.api_key, username, extended.to_s))
  raise ResponseError.new(response) if response.code != 200

  response.parsed_response.collect do |item|
    Mash.new(item)
  end
end