aria2_driver 0.0.6 → 0.0.7
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 +8 -8
- data/lib/aria2_driver/json_rpc/client.rb +7 -1
- data/lib/aria2_driver/version.rb +1 -1
- data/spec/aria2_driver/json_rpc/client_spec.rb +63 -0
- data/spec/support/mocks/json_rpc/force_remove.rb +23 -0
- data/spec/support/mocks/json_rpc/purge_download_result.rb +23 -0
- data/spec/support/mocks/json_rpc/remove_download_result.rb +23 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTE2NjcxNDA4NDVmNDQ5ZmZlNGQxMmRiZDMxZDIxOGM2YmUzMGMzNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDI3YWIxOTA4ZTQ5M2RmODFkYzg3MjA2YjliN2FiMzZiYzBkY2I5NQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTQxODQ2ZDYxZjFiYzFkNjNjNGMyYmEzMzhjZjE4MzRlYjdkMzI5MmFjM2Ux
|
10
|
+
ZTBmYWQ1YjVkNzEyODc3NDBlNWZhODZkN2VlOWY3YzdlMzUxMzFkYzE2MDM2
|
11
|
+
ZGQxMTkzNmQ0ZDQ4ZGEzMWJhNGI0MjMxN2U0NDkzOWMxZjNjNzE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzFhOGMzZjRkOTE5NmMxNDM4YjY4MzIzZTdjNmViNTdmNzg1YjY3N2RmZGJk
|
14
|
+
MDExMGEyM2IwZjZiMWI0Yzc1MTBhZDFlMGVmMjU0MmMzMzM3M2VkMTM2MDJh
|
15
|
+
YjBhZTZjYjAzNzYzMWIwOWE4MjRiYTQwOWQzNDBmNTQ0ODBmNzE=
|
@@ -58,7 +58,13 @@ module Aria2Driver
|
|
58
58
|
private
|
59
59
|
|
60
60
|
def supported_request?(request)
|
61
|
-
[
|
61
|
+
[
|
62
|
+
:get_version,
|
63
|
+
:add_uri,
|
64
|
+
:remove, :force_remove,
|
65
|
+
:remove_download_result, :purge_download_result,
|
66
|
+
:tell_status
|
67
|
+
].include?(request)
|
62
68
|
end
|
63
69
|
|
64
70
|
def snake_lower_camel(snake)
|
data/lib/aria2_driver/version.rb
CHANGED
@@ -2,6 +2,9 @@ require 'spec_helper'
|
|
2
2
|
require 'support/mocks/json_rpc/get_version'
|
3
3
|
require 'support/mocks/json_rpc/add_uri'
|
4
4
|
require 'support/mocks/json_rpc/remove'
|
5
|
+
require 'support/mocks/json_rpc/force_remove'
|
6
|
+
require 'support/mocks/json_rpc/remove_download_result'
|
7
|
+
require 'support/mocks/json_rpc/purge_download_result'
|
5
8
|
require 'support/mocks/json_rpc/tell_status'
|
6
9
|
|
7
10
|
module Aria2Driver
|
@@ -141,6 +144,66 @@ module Aria2Driver
|
|
141
144
|
end
|
142
145
|
end
|
143
146
|
|
147
|
+
describe 'force remove' do
|
148
|
+
it 'remove request using force' do
|
149
|
+
stubbed_request = Mocks::JsonRpc::ForceRemoveRequest.new('localhost',
|
150
|
+
{
|
151
|
+
port: 80,
|
152
|
+
params: [
|
153
|
+
'token:abcd-1234',
|
154
|
+
'2089b05ecca3d829'
|
155
|
+
]
|
156
|
+
})
|
157
|
+
mock_response = Mocks::JsonRpc::ForceRemoveSuccessfulResponse.new
|
158
|
+
stubbed_request.with_response(mock_response)
|
159
|
+
|
160
|
+
response = aria2.force_remove({params: ['2089b05ecca3d829']})
|
161
|
+
|
162
|
+
expect(response.error?).to be_falsey
|
163
|
+
expect(response.result).to eq(mock_response.result)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
describe 'remove download result' do
|
168
|
+
it 'remove download result request' do
|
169
|
+
stubbed_request = Mocks::JsonRpc::RemoveDownloadResultRequest.new('localhost',
|
170
|
+
{
|
171
|
+
port: 80,
|
172
|
+
params: [
|
173
|
+
'token:abcd-1234',
|
174
|
+
'2089b05ecca3d829'
|
175
|
+
]
|
176
|
+
})
|
177
|
+
mock_response = Mocks::JsonRpc::RemoveDownloadResultSuccessfulResponse.new
|
178
|
+
stubbed_request.with_response(mock_response)
|
179
|
+
|
180
|
+
response = aria2.remove_download_result({params: ['2089b05ecca3d829']})
|
181
|
+
|
182
|
+
expect(response.error?).to be_falsey
|
183
|
+
expect(response.result).to eq(mock_response.result)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
describe 'purge download result' do
|
188
|
+
it 'purge download result request' do
|
189
|
+
stubbed_request = Mocks::JsonRpc::PurgeDownloadResultRequest.new('localhost',
|
190
|
+
{
|
191
|
+
port: 80,
|
192
|
+
params: [
|
193
|
+
'token:abcd-1234'
|
194
|
+
]
|
195
|
+
})
|
196
|
+
mock_response = Mocks::JsonRpc::PurgeDownloadResultSuccessfulResponse.new
|
197
|
+
stubbed_request.with_response(mock_response)
|
198
|
+
stubbed_request.with_response(mock_response)
|
199
|
+
|
200
|
+
response = aria2.purge_download_result()
|
201
|
+
|
202
|
+
expect(response.error?).to be_falsey
|
203
|
+
expect(response.result).to eq(mock_response.result)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
144
207
|
describe 'status' do
|
145
208
|
it 'tell_status simple request' do
|
146
209
|
stubbed_request = Mocks::JsonRpc::TellStatusRequest.new('localhost',
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative './request'
|
2
|
+
require_relative './response'
|
3
|
+
|
4
|
+
module Mocks
|
5
|
+
module JsonRpc
|
6
|
+
|
7
|
+
class ForceRemoveSuccessfulResponse < SuccessfulResponse
|
8
|
+
def result
|
9
|
+
"2089b05ecca3d829"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class ForceRemoveRequest < Request
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def rpc_method
|
18
|
+
'aria2.forceRemove'
|
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 PurgeDownloadResultSuccessfulResponse < SuccessfulResponse
|
8
|
+
def result
|
9
|
+
"OK"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class PurgeDownloadResultRequest < Request
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def rpc_method
|
18
|
+
'aria2.purgeDownloadResult'
|
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 RemoveDownloadResultSuccessfulResponse < SuccessfulResponse
|
8
|
+
def result
|
9
|
+
"OK"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class RemoveDownloadResultRequest < Request
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def rpc_method
|
18
|
+
'aria2.removeDownloadResult'
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Ciatti
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -111,8 +111,11 @@ 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_remove.rb
|
114
115
|
- spec/support/mocks/json_rpc/get_version.rb
|
116
|
+
- spec/support/mocks/json_rpc/purge_download_result.rb
|
115
117
|
- spec/support/mocks/json_rpc/remove.rb
|
118
|
+
- spec/support/mocks/json_rpc/remove_download_result.rb
|
116
119
|
- spec/support/mocks/json_rpc/request.rb
|
117
120
|
- spec/support/mocks/json_rpc/response.rb
|
118
121
|
- spec/support/mocks/json_rpc/tell_status.rb
|
@@ -148,8 +151,11 @@ test_files:
|
|
148
151
|
- spec/aria2_driver/json_rpc/response_spec.rb
|
149
152
|
- spec/spec_helper.rb
|
150
153
|
- spec/support/mocks/json_rpc/add_uri.rb
|
154
|
+
- spec/support/mocks/json_rpc/force_remove.rb
|
151
155
|
- spec/support/mocks/json_rpc/get_version.rb
|
156
|
+
- spec/support/mocks/json_rpc/purge_download_result.rb
|
152
157
|
- spec/support/mocks/json_rpc/remove.rb
|
158
|
+
- spec/support/mocks/json_rpc/remove_download_result.rb
|
153
159
|
- spec/support/mocks/json_rpc/request.rb
|
154
160
|
- spec/support/mocks/json_rpc/response.rb
|
155
161
|
- spec/support/mocks/json_rpc/tell_status.rb
|