qbt_client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +78 -0
- data/Rakefile +7 -0
- data/lib/qbt_client/version.rb +3 -0
- data/lib/qbt_client/web_ui.rb +608 -0
- data/lib/qbt_client.rb +6 -0
- data/qbt_client.gemspec +28 -0
- data/spec/lib/qbt_client/web_ui_spec.rb +642 -0
- data/spec/lib/qbt_client_spec.rb +11 -0
- data/spec/spec_helper.rb +161 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 02480b67133ef8c463c04c2b734414497e1f98a5
|
4
|
+
data.tar.gz: 9e6287af4b5e9ff231454974ff8ba017ec7d3ea7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8c52453b44a058de5436aaff5da9fb1592ac2663e49752742751247086bd6b35e6c321d8fafed478c193255413a0b0a92c632b8197842b09c82b5a5fe1639d17
|
7
|
+
data.tar.gz: 64a53add284788198d77aec93a73c4039dc5152f3d616e9912e336fe62d4581147ea8b0b0d8c38d4fac25cf729afdaaafc4be1c9eb8e6d270658f060c71a6197
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Jeff McAffee
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# QbtClient
|
2
|
+
|
3
|
+
A Ruby gem to access qBittorrent's [WebUI](https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-Documentation)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'qbt_client'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install qbt_client
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Instantiate the client
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require 'qtb_client'
|
27
|
+
|
28
|
+
ip = 'http://127.0.0.1' # Protocol is required.
|
29
|
+
port = 8083
|
30
|
+
user = 'admin'
|
31
|
+
pass = 'abc'
|
32
|
+
|
33
|
+
client = QtbClient::WebUI.new(ip, port, user, pass)
|
34
|
+
```
|
35
|
+
|
36
|
+
Call methods on the client
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
# Get list of torrents:
|
40
|
+
torrents = client.torrent_list
|
41
|
+
|
42
|
+
|
43
|
+
torrent_properties = {}
|
44
|
+
|
45
|
+
# Using each torrent's hash, get the torrents properties:
|
46
|
+
torrents.each do |t|
|
47
|
+
hash = t['hash']
|
48
|
+
|
49
|
+
torrent_properties[hash] = client.properties hash
|
50
|
+
|
51
|
+
# Get the torrent's trackers too
|
52
|
+
torrent_properties[hash]['trackers'] = client.trackers hash
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
## Testing
|
57
|
+
|
58
|
+
To run the tests, you'll need to have qBittorrent installed locally, WebUI
|
59
|
+
turned on, and the credentials set to:
|
60
|
+
|
61
|
+
- user: admin
|
62
|
+
- pass: abc
|
63
|
+
|
64
|
+
The tests assume that qBittorrent is running at 127.0.0.1, port 8083.
|
65
|
+
|
66
|
+
From the root project dir, run:
|
67
|
+
|
68
|
+
$ rspec spec/
|
69
|
+
|
70
|
+
## Contributing
|
71
|
+
|
72
|
+
1. Fork it ( https://github.com/jmcaffee/qbt_client/fork )
|
73
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
74
|
+
3. Create your tests
|
75
|
+
4. Commit your changes (`git commit -am 'Add some feature'`)
|
76
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
77
|
+
6. Create a new Pull Request
|
78
|
+
|
data/Rakefile
ADDED