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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTE2NjcxNDA4NDVmNDQ5ZmZlNGQxMmRiZDMxZDIxOGM2YmUzMGMzNA==
4
+ NmM1YWFiZWIxN2Q4YjIyZTFlYjgzZjVkYjY3ZmYxZTg2MzIwMDYyYQ==
5
5
  data.tar.gz: !binary |-
6
- ZDI3YWIxOTA4ZTQ5M2RmODFkYzg3MjA2YjliN2FiMzZiYzBkY2I5NQ==
6
+ YmNjYWRlZDMwOTI1M2IwNTEyMDVhM2VjMjdjY2FkMmI3ZGU4ZmJiNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTQxODQ2ZDYxZjFiYzFkNjNjNGMyYmEzMzhjZjE4MzRlYjdkMzI5MmFjM2Ux
10
- ZTBmYWQ1YjVkNzEyODc3NDBlNWZhODZkN2VlOWY3YzdlMzUxMzFkYzE2MDM2
11
- ZGQxMTkzNmQ0ZDQ4ZGEzMWJhNGI0MjMxN2U0NDkzOWMxZjNjNzE=
9
+ MTVkMDkzMTVkMzJiNTE1NTgwZmZlZmE4Nzg3ZTBlMWMwYTJhYjkyMTZlYmY5
10
+ OWY1ODE5ZDNlMTc2ODdmYmQzZGE3NWJjNmNhNmY2MTkwMzQ1M2NkZjFmYTZh
11
+ NjI4NWM4MGVlMWQ3MGU1NDU2ZDJkZjIxMTI5N2E5YWM5MWRjYzA=
12
12
  data.tar.gz: !binary |-
13
- MzFhOGMzZjRkOTE5NmMxNDM4YjY4MzIzZTdjNmViNTdmNzg1YjY3N2RmZGJk
14
- MDExMGEyM2IwZjZiMWI0Yzc1MTBhZDFlMGVmMjU0MmMzMzM3M2VkMTM2MDJh
15
- YjBhZTZjYjAzNzYzMWIwOWE4MjRiYTQwOWQzNDBmNTQ0ODBmNzE=
13
+ YjVkOWQxODZhYjQ3MTgxMGYyOGI0Zjg4YmI2ZDRjODFiYjMxNTkwN2Y0ZTdm
14
+ MzliNzViMDkzYjdlYjg1NzFhYTJmNDgzMWY3ZTBhOGI5ZjNiZTY0MmIwNzQ1
15
+ YzBmNjBjZWViYWEwZDY0ZTcyNzIyOTNhY2M1NmE0NTcyYTQ3Yzc=
data/.travis.yml CHANGED
@@ -27,3 +27,4 @@ deploy:
27
27
  on:
28
28
  tags: true
29
29
  repo: OverHillLab/aria2_driver
30
+
@@ -63,7 +63,8 @@ module Aria2Driver
63
63
  :add_uri,
64
64
  :remove, :force_remove,
65
65
  :remove_download_result, :purge_download_result,
66
- :tell_status
66
+ :tell_status,
67
+ :pause, :force_pause
67
68
  ].include?(request)
68
69
  end
69
70
 
@@ -1,3 +1,3 @@
1
1
  module Aria2Driver
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -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.7
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