Module: QBittorrent::WebApi::Authroize

Included in:
Api
Defined in:
lib/qbittorrent/web_api/authorize.rb

Instance Method Summary collapse

Instance Method Details

#loginObject

Raises:



4
5
6
7
8
9
10
11
12
# File 'lib/qbittorrent/web_api/authorize.rb', line 4

def 
  response = api_client.post("#{host}/api/v2/auth/login", form: {
                               username: username,
                               password: password
                             })
  raise QBittorrent::Error.new('Authroize faild', response) unless response.headers['set-cookie']

  @cookies = response.headers['set-cookie'].split(';')[0]
end

#logoutObject



14
15
16
17
18
# File 'lib/qbittorrent/web_api/authorize.rb', line 14

def logout
  response = api_client.post("#{host}/api/v2/auth/logout")
  @cookies = nil
  response
end