aria2_driver 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +1 -0
- data/lib/aria2_driver/json_rpc/client.rb +2 -1
- data/lib/aria2_driver/version.rb +1 -1
- data/spec/aria2_driver/json_rpc/client_spec.rb +42 -0
- data/spec/support/mocks/json_rpc/force_pause.rb +23 -0
- data/spec/support/mocks/json_rpc/pause.rb +23 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmM1YWFiZWIxN2Q4YjIyZTFlYjgzZjVkYjY3ZmYxZTg2MzIwMDYyYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmNjYWRlZDMwOTI1M2IwNTEyMDVhM2VjMjdjY2FkMmI3ZGU4ZmJiNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTVkMDkzMTVkMzJiNTE1NTgwZmZlZmE4Nzg3ZTBlMWMwYTJhYjkyMTZlYmY5
|
10
|
+
OWY1ODE5ZDNlMTc2ODdmYmQzZGE3NWJjNmNhNmY2MTkwMzQ1M2NkZjFmYTZh
|
11
|
+
NjI4NWM4MGVlMWQ3MGU1NDU2ZDJkZjIxMTI5N2E5YWM5MWRjYzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjVkOWQxODZhYjQ3MTgxMGYyOGI0Zjg4YmI2ZDRjODFiYjMxNTkwN2Y0ZTdm
|
14
|
+
MzliNzViMDkzYjdlYjg1NzFhYTJmNDgzMWY3ZTBhOGI5ZjNiZTY0MmIwNzQ1
|
15
|
+
YzBmNjBjZWViYWEwZDY0ZTcyNzIyOTNhY2M1NmE0NTcyYTQ3Yzc=
|
data/.travis.yml
CHANGED
data/lib/aria2_driver/version.rb
CHANGED
@@ -6,6 +6,8 @@ require 'support/mocks/json_rpc/force_remove'
|
|
6
6
|
require 'support/mocks/json_rpc/remove_download_result'
|
7
7
|
require 'support/mocks/json_rpc/purge_download_result'
|
8
8
|
require 'support/mocks/json_rpc/tell_status'
|
9
|
+
require 'support/mocks/json_rpc/pause'
|
10
|
+
require 'support/mocks/json_rpc/force_pause'
|
9
11
|
|
10
12
|
module Aria2Driver
|
11
13
|
module JsonRpc
|
@@ -242,6 +244,46 @@ module Aria2Driver
|
|
242
244
|
expect(response.result).to eq({"gid" => "2089b05ecca3d829", "status" => "active"})
|
243
245
|
end
|
244
246
|
end
|
247
|
+
|
248
|
+
describe 'pause' do
|
249
|
+
it 'pause request' do
|
250
|
+
stubbed_request = Mocks::JsonRpc::PauseRequest.new('localhost',
|
251
|
+
{
|
252
|
+
port: 80,
|
253
|
+
params: [
|
254
|
+
'token:abcd-1234',
|
255
|
+
'2089b05ecca3d829'
|
256
|
+
]
|
257
|
+
})
|
258
|
+
mock_response = Mocks::JsonRpc::PauseSuccessfulResponse.new
|
259
|
+
stubbed_request.with_response(mock_response)
|
260
|
+
|
261
|
+
response = aria2.pause({params: ['2089b05ecca3d829']})
|
262
|
+
|
263
|
+
expect(response.error?).to be_falsey
|
264
|
+
expect(response.result).to eq(mock_response.result)
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
describe 'force pause' do
|
269
|
+
it 'pause request' do
|
270
|
+
stubbed_request = Mocks::JsonRpc::ForcePauseRequest.new('localhost',
|
271
|
+
{
|
272
|
+
port: 80,
|
273
|
+
params: [
|
274
|
+
'token:abcd-1234',
|
275
|
+
'2089b05ecca3d829'
|
276
|
+
]
|
277
|
+
})
|
278
|
+
mock_response = Mocks::JsonRpc::ForcePauseSuccessfulResponse.new
|
279
|
+
stubbed_request.with_response(mock_response)
|
280
|
+
|
281
|
+
response = aria2.force_pause({params: ['2089b05ecca3d829']})
|
282
|
+
|
283
|
+
expect(response.error?).to be_falsey
|
284
|
+
expect(response.result).to eq(mock_response.result)
|
285
|
+
end
|
286
|
+
end
|
245
287
|
end
|
246
288
|
end
|
247
289
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative './request'
|
2
|
+
require_relative './response'
|
3
|
+
|
4
|
+
module Mocks
|
5
|
+
module JsonRpc
|
6
|
+
|
7
|
+
class ForcePauseSuccessfulResponse < SuccessfulResponse
|
8
|
+
def result
|
9
|
+
"2089b05ecca3d829"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class ForcePauseRequest < Request
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def rpc_method
|
18
|
+
'aria2.forcePause'
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative './request'
|
2
|
+
require_relative './response'
|
3
|
+
|
4
|
+
module Mocks
|
5
|
+
module JsonRpc
|
6
|
+
|
7
|
+
class PauseSuccessfulResponse < SuccessfulResponse
|
8
|
+
def result
|
9
|
+
"2089b05ecca3d829"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class PauseRequest < Request
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def rpc_method
|
18
|
+
'aria2.pause'
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Ciatti
|
@@ -111,8 +111,10 @@ files:
|
|
111
111
|
- spec/aria2_driver/json_rpc/response_spec.rb
|
112
112
|
- spec/spec_helper.rb
|
113
113
|
- spec/support/mocks/json_rpc/add_uri.rb
|
114
|
+
- spec/support/mocks/json_rpc/force_pause.rb
|
114
115
|
- spec/support/mocks/json_rpc/force_remove.rb
|
115
116
|
- spec/support/mocks/json_rpc/get_version.rb
|
117
|
+
- spec/support/mocks/json_rpc/pause.rb
|
116
118
|
- spec/support/mocks/json_rpc/purge_download_result.rb
|
117
119
|
- spec/support/mocks/json_rpc/remove.rb
|
118
120
|
- spec/support/mocks/json_rpc/remove_download_result.rb
|
@@ -151,8 +153,10 @@ test_files:
|
|
151
153
|
- spec/aria2_driver/json_rpc/response_spec.rb
|
152
154
|
- spec/spec_helper.rb
|
153
155
|
- spec/support/mocks/json_rpc/add_uri.rb
|
156
|
+
- spec/support/mocks/json_rpc/force_pause.rb
|
154
157
|
- spec/support/mocks/json_rpc/force_remove.rb
|
155
158
|
- spec/support/mocks/json_rpc/get_version.rb
|
159
|
+
- spec/support/mocks/json_rpc/pause.rb
|
156
160
|
- spec/support/mocks/json_rpc/purge_download_result.rb
|
157
161
|
- spec/support/mocks/json_rpc/remove.rb
|
158
162
|
- spec/support/mocks/json_rpc/remove_download_result.rb
|