Module: Traktr::Account

Includes:
HTTParty
Defined in:
lib/traktr/account.rb

Class Method Summary collapse

Class Method Details

.settingsObject

Raises:

  • (ResponseError)


6
7
8
9
10
11
12
# File 'lib/traktr/account.rb', line 6

def self.settings
  data = { username: Traktr.username, password: Traktr.password }
  response = self.post("/" + File.join("settings", 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

.testObject

Raises:

  • (ResponseError)


14
15
16
17
18
19
20
# File 'lib/traktr/account.rb', line 14

def self.test
  data = { username: Traktr.username, password: Traktr.password }
  response = self.post("/" + File.join("test", 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