aria2_driver 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjJhYWZhNjhlOTFkMDMzMzQ4ZTQ0ZTZjMjYyZDg5NWI0OTZiZmVlYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTIzYWQ4NTE1OGI5YmRhNDNiOGY3OWYwODE0ZDNlNTY5NGQ0N2E1Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2ZmM2E2NjY0MWIxYzVmMzQ1MjJlYzUxMDM3NTEwMWM3MzgyZjg5YzI1MWVi
|
10
|
+
MTVmZWE0MjFjMjUzMGQyZDMxYmUxZmI0YmE2YjQzY2U0Njg3NmVmMGJlZDk5
|
11
|
+
ZTE4MzAzMzc3MzE1ZmIyNmJiNTFjZjc1MjA4ZmMzNTg0OTJkMzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTdiMTg0OWVmY2U3ODU1ZTRkNDE5YjI0ZTZkOWE0NzZkMmI5Y2VlZjBmOGM2
|
14
|
+
YmQzNjNiZWNkNDQ3OTQyMzQ3YjM0OTI1MjBmMjE2YWJjYmQ3NTBiODM0OWE3
|
15
|
+
YWNiYzFhOTNmNzI3YTUzOGQ1OWQ2NzgzNzAzMWU1ZjQ5MTA0Nzc=
|
data/lib/aria2_driver/version.rb
CHANGED
@@ -8,6 +8,8 @@ require 'support/mocks/json_rpc/purge_download_result'
|
|
8
8
|
require 'support/mocks/json_rpc/tell_status'
|
9
9
|
require 'support/mocks/json_rpc/pause'
|
10
10
|
require 'support/mocks/json_rpc/force_pause'
|
11
|
+
require 'support/mocks/json_rpc/get_files'
|
12
|
+
require 'support/mocks/json_rpc/get_uris'
|
11
13
|
|
12
14
|
module Aria2Driver
|
13
15
|
module JsonRpc
|
@@ -284,6 +286,46 @@ module Aria2Driver
|
|
284
286
|
expect(response.result).to eq(mock_response.result)
|
285
287
|
end
|
286
288
|
end
|
289
|
+
|
290
|
+
describe 'get files' do
|
291
|
+
it 'get files request' do
|
292
|
+
stubbed_request = Mocks::JsonRpc::GetFilesRequest.new('localhost',
|
293
|
+
{
|
294
|
+
port: 80,
|
295
|
+
params: [
|
296
|
+
'token:abcd-1234',
|
297
|
+
'2089b05ecca3d829'
|
298
|
+
]
|
299
|
+
})
|
300
|
+
mock_response = Mocks::JsonRpc::GetFilesSuccessfulResponse.new
|
301
|
+
stubbed_request.with_response(mock_response)
|
302
|
+
|
303
|
+
response = aria2.get_files({params: ['2089b05ecca3d829']})
|
304
|
+
|
305
|
+
expect(response.error?).to be_falsey
|
306
|
+
expect(response.result).to eq(mock_response.result)
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
describe 'get uris' do
|
311
|
+
it 'get uris request' do
|
312
|
+
stubbed_request = Mocks::JsonRpc::GetUrisRequest.new('localhost',
|
313
|
+
{
|
314
|
+
port: 80,
|
315
|
+
params: [
|
316
|
+
'token:abcd-1234',
|
317
|
+
'2089b05ecca3d829'
|
318
|
+
]
|
319
|
+
})
|
320
|
+
mock_response = Mocks::JsonRpc::GetUrisSuccessfulResponse.new
|
321
|
+
stubbed_request.with_response(mock_response)
|
322
|
+
|
323
|
+
response = aria2.get_uris({params: ['2089b05ecca3d829']})
|
324
|
+
|
325
|
+
expect(response.error?).to be_falsey
|
326
|
+
expect(response.result).to eq(mock_response.result)
|
327
|
+
end
|
328
|
+
end
|
287
329
|
end
|
288
330
|
end
|
289
331
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative './request'
|
2
|
+
require_relative './response'
|
3
|
+
|
4
|
+
module Mocks
|
5
|
+
module JsonRpc
|
6
|
+
|
7
|
+
class GetFilesSuccessfulResponse < SuccessfulResponse
|
8
|
+
def result
|
9
|
+
[
|
10
|
+
{
|
11
|
+
'index' => '1',
|
12
|
+
'length' => '34896138',
|
13
|
+
'completedLength' => '34896138',
|
14
|
+
'path' => '/downloads/file',
|
15
|
+
'selected' => 'true',
|
16
|
+
'uris' => [
|
17
|
+
{
|
18
|
+
'status' => 'used',
|
19
|
+
'uri' => 'http://example.org/file'
|
20
|
+
}
|
21
|
+
]
|
22
|
+
}
|
23
|
+
]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class GetFilesRequest < Request
|
28
|
+
|
29
|
+
protected
|
30
|
+
|
31
|
+
def rpc_method
|
32
|
+
'aria2.getFiles'
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative './request'
|
2
|
+
require_relative './response'
|
3
|
+
|
4
|
+
module Mocks
|
5
|
+
module JsonRpc
|
6
|
+
|
7
|
+
class GetUrisSuccessfulResponse < SuccessfulResponse
|
8
|
+
def result
|
9
|
+
[
|
10
|
+
{
|
11
|
+
'status' => 'used',
|
12
|
+
'uri' => 'http://example.org/file'
|
13
|
+
}
|
14
|
+
]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class GetUrisRequest < Request
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def rpc_method
|
23
|
+
'aria2.getUris'
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aria2_driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Ciatti
|
@@ -113,6 +113,8 @@ files:
|
|
113
113
|
- spec/support/mocks/json_rpc/add_uri.rb
|
114
114
|
- spec/support/mocks/json_rpc/force_pause.rb
|
115
115
|
- spec/support/mocks/json_rpc/force_remove.rb
|
116
|
+
- spec/support/mocks/json_rpc/get_files.rb
|
117
|
+
- spec/support/mocks/json_rpc/get_uris.rb
|
116
118
|
- spec/support/mocks/json_rpc/get_version.rb
|
117
119
|
- spec/support/mocks/json_rpc/pause.rb
|
118
120
|
- spec/support/mocks/json_rpc/purge_download_result.rb
|
@@ -155,6 +157,8 @@ test_files:
|
|
155
157
|
- spec/support/mocks/json_rpc/add_uri.rb
|
156
158
|
- spec/support/mocks/json_rpc/force_pause.rb
|
157
159
|
- spec/support/mocks/json_rpc/force_remove.rb
|
160
|
+
- spec/support/mocks/json_rpc/get_files.rb
|
161
|
+
- spec/support/mocks/json_rpc/get_uris.rb
|
158
162
|
- spec/support/mocks/json_rpc/get_version.rb
|
159
163
|
- spec/support/mocks/json_rpc/pause.rb
|
160
164
|
- spec/support/mocks/json_rpc/purge_download_result.rb
|