Class: Traktr::Account
- Inherits:
-
Object
- Object
- Traktr::Account
- Includes:
- HTTParty
- Defined in:
- lib/traktr/account.rb
Instance Method Summary collapse
-
#initialize(client) ⇒ Account
constructor
A new instance of Account.
- #settings ⇒ Object
- #test ⇒ Object
Constructor Details
#initialize(client) ⇒ Account
Returns a new instance of Account.
6 7 8 |
# File 'lib/traktr/account.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#settings ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/traktr/account.rb', line 10 def settings data = { username: @client.username, password: @client.password } response = self.class.post("/" + File.join("settings", @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 |
#test ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/traktr/account.rb', line 18 def test data = { username: @client.username, password: @client.password } response = self.class.post("/" + File.join("test", @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 |