aria2_driver 0.0.9 → 0.1.0

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
- NjJhYWZhNjhlOTFkMDMzMzQ4ZTQ0ZTZjMjYyZDg5NWI0OTZiZmVlYg==
4
+ OTFiMGIxODM0ZjBiYzVjYTRlYWE3OWE2ZjgzZjczNmQxOTc1MjBkMQ==
5
5
  data.tar.gz: !binary |-
6
- YTIzYWQ4NTE1OGI5YmRhNDNiOGY3OWYwODE0ZDNlNTY5NGQ0N2E1Ng==
6
+ Njk2YzE4ZjQxYzU4NTU4MzZiNzllZGIyODhhOWQzYTdjZTJmNDMwOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2ZmM2E2NjY0MWIxYzVmMzQ1MjJlYzUxMDM3NTEwMWM3MzgyZjg5YzI1MWVi
10
- MTVmZWE0MjFjMjUzMGQyZDMxYmUxZmI0YmE2YjQzY2U0Njg3NmVmMGJlZDk5
11
- ZTE4MzAzMzc3MzE1ZmIyNmJiNTFjZjc1MjA4ZmMzNTg0OTJkMzA=
9
+ MzJlNzM4MGRjNTk4MjQ4MDk3YzdjODQ2ZjljMmU4ZmM5N2UwYjNmMGQ3ZDE5
10
+ Y2U2ODMwYTkwOWVhNjdkZmI2ZmFkYjEyMjViZTA3YWUzNjEwNTJjZGIzMWRl
11
+ MTk2ZDUwOWFjNzYyMzk3NjUyN2I2NmExY2M3ZTk4YTQxYmYwMjc=
12
12
  data.tar.gz: !binary |-
13
- MTdiMTg0OWVmY2U3ODU1ZTRkNDE5YjI0ZTZkOWE0NzZkMmI5Y2VlZjBmOGM2
14
- YmQzNjNiZWNkNDQ3OTQyMzQ3YjM0OTI1MjBmMjE2YWJjYmQ3NTBiODM0OWE3
15
- YWNiYzFhOTNmNzI3YTUzOGQ1OWQ2NzgzNzAzMWU1ZjQ5MTA0Nzc=
13
+ ZTgwZWZjMWEzMTJhNDQ1MjBjNzVjMDMwYmQzZGVkMDI1OGMyNmZkMzA2NDgz
14
+ YjRmOTlkNTEwNzc2OGJhMjQxMTYzZmM2YTEwYWE5MDc2ODkwY2UxZTQwMmRh
15
+ MDA4ZDc3N2YyNDE0ZDgyY2E2OWI0MmZiMGEwMTJlNGZmZDE3NTI=
@@ -65,7 +65,8 @@ module Aria2Driver
65
65
  :remove_download_result, :purge_download_result,
66
66
  :tell_status,
67
67
  :pause, :force_pause,
68
- :get_files, :get_uris
68
+ :get_files, :get_uris,
69
+ :get_global_stat
69
70
  ].include?(request)
70
71
  end
71
72
 
@@ -1,3 +1,3 @@
1
1
  module Aria2Driver
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -10,11 +10,11 @@ require 'support/mocks/json_rpc/pause'
10
10
  require 'support/mocks/json_rpc/force_pause'
11
11
  require 'support/mocks/json_rpc/get_files'
12
12
  require 'support/mocks/json_rpc/get_uris'
13
+ require 'support/mocks/json_rpc/get_global_stat'
13
14
 
14
15
  module Aria2Driver
15
16
  module JsonRpc
16
17
 
17
-
18
18
  describe Client do
19
19
 
20
20
  it 'should create with defaults' do
@@ -326,6 +326,25 @@ module Aria2Driver
326
326
  expect(response.result).to eq(mock_response.result)
327
327
  end
328
328
  end
329
+
330
+ describe 'get stat' do
331
+ it 'get global stat request' do
332
+ stubbed_request = Mocks::JsonRpc::GetGlobalStatRequest.new('localhost',
333
+ {
334
+ port: 80,
335
+ params: [
336
+ 'token:abcd-1234'
337
+ ]
338
+ })
339
+ mock_response = Mocks::JsonRpc::GetGlobalStatSuccessfulResponse.new
340
+ stubbed_request.with_response(mock_response)
341
+
342
+ response = aria2.get_global_stat
343
+
344
+ expect(response.error?).to be_falsey
345
+ expect(response.result).to eq(mock_response.result)
346
+ end
347
+ end
329
348
  end
330
349
  end
331
350
 
@@ -0,0 +1,30 @@
1
+ require_relative './request'
2
+ require_relative './response'
3
+
4
+ module Mocks
5
+ module JsonRpc
6
+
7
+ class GetGlobalStatSuccessfulResponse < SuccessfulResponse
8
+ def result
9
+ {
10
+ 'downloadSpeed' => '2000',
11
+ 'uploadSpeed' => '1000',
12
+ 'numActive' => '2',
13
+ 'numWaiting' => '1000',
14
+ 'numStopped' => '0',
15
+ 'numStoppedTotal' => '0'
16
+ }
17
+ end
18
+ end
19
+
20
+ class GetGlobalStatRequest < Request
21
+
22
+ protected
23
+
24
+ def rpc_method
25
+ 'aria2.getGlobalStat'
26
+ end
27
+
28
+ end
29
+ end
30
+ 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.9
4
+ version: 0.1.0
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-15 00:00:00.000000000 Z
12
+ date: 2015-05-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -114,6 +114,7 @@ files:
114
114
  - spec/support/mocks/json_rpc/force_pause.rb
115
115
  - spec/support/mocks/json_rpc/force_remove.rb
116
116
  - spec/support/mocks/json_rpc/get_files.rb
117
+ - spec/support/mocks/json_rpc/get_global_stat.rb
117
118
  - spec/support/mocks/json_rpc/get_uris.rb
118
119
  - spec/support/mocks/json_rpc/get_version.rb
119
120
  - spec/support/mocks/json_rpc/pause.rb
@@ -158,6 +159,7 @@ test_files:
158
159
  - spec/support/mocks/json_rpc/force_pause.rb
159
160
  - spec/support/mocks/json_rpc/force_remove.rb
160
161
  - spec/support/mocks/json_rpc/get_files.rb
162
+ - spec/support/mocks/json_rpc/get_global_stat.rb
161
163
  - spec/support/mocks/json_rpc/get_uris.rb
162
164
  - spec/support/mocks/json_rpc/get_version.rb
163
165
  - spec/support/mocks/json_rpc/pause.rb