transmission-rpc-ruby 0.3.1 → 0.4.0
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +17 -0
- data/lib/transmission/arguments.rb +1 -0
- data/lib/transmission/arguments/location_set.rb +13 -0
- data/lib/transmission/model/torrent.rb +4 -0
- data/lib/transmission/rpc.rb +6 -0
- data/spec/helpers/stubs.rb +10 -0
- data/spec/transmission/model/torrent_spec.rb +13 -0
- data/transmission-rpc-ruby.gemspec +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36f7ba02b6c73c6470c5325c3d9beb46a018715a
|
4
|
+
data.tar.gz: a6831e5413f25ba30f9a86ffc277dd0340452665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5dceb327feb0da37fe6df7d430fe2ca822a8e9f14f4f077e3b64b784fdd7c94bb5ab67d4c2ce48b2ab8d9bad496ddfaf1cc7a7b3247c97a1455c7bd28418562
|
7
|
+
data.tar.gz: 2fd940b6a973a647d856d936c082da43a3970110eba5b9281f6fdb950ba05673070084b7f8bd944ffea2749305fcb3ab50b34fa030af979cf5d569f9601959fe
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -123,6 +123,17 @@ The `save!` method will update the torrent on your remote transmission daemon.
|
|
123
123
|
|
124
124
|
To find all the torrent [accessors](https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt#L127) & [mutators](https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt#L90) visit [spec](https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt)
|
125
125
|
|
126
|
+
#### Change torrent location
|
127
|
+
|
128
|
+
id = 1
|
129
|
+
torrent = Transmission::Model::Torrent.find(id)
|
130
|
+
|
131
|
+
# Copies torrent to new location
|
132
|
+
torrent.set_location '/some/new/path'
|
133
|
+
|
134
|
+
# Moves torrent to new location
|
135
|
+
torrent.set_location '/some/new/path', true
|
136
|
+
|
126
137
|
#### Start & Stop all torrents
|
127
138
|
|
128
139
|
You can also start and stop all torrents
|
@@ -223,6 +234,12 @@ For more methods check out `lib/transmission/rpc.rb`
|
|
223
234
|
|
224
235
|
## Changelog
|
225
236
|
|
237
|
+
### v0.4.0 (2015-05-09)
|
238
|
+
|
239
|
+
Features:
|
240
|
+
|
241
|
+
- Added `set_location` method to torrent model (thanks @balinez)
|
242
|
+
|
226
243
|
### v0.3.1 (2015-04-03)
|
227
244
|
|
228
245
|
Bugfixes:
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'arguments', 'torrent_add')
|
2
2
|
require File.join(File.dirname(__FILE__), 'arguments', 'torrent_set')
|
3
3
|
require File.join(File.dirname(__FILE__), 'arguments', 'session_set')
|
4
|
+
require File.join(File.dirname(__FILE__), 'arguments', 'location_set')
|
4
5
|
require File.join(File.dirname(__FILE__), 'utils')
|
5
6
|
|
6
7
|
module Transmission
|
data/lib/transmission/rpc.rb
CHANGED
@@ -60,6 +60,12 @@ module Transmission
|
|
60
60
|
@connector.post method: 'torrent-add', arguments: arguments.to_arguments
|
61
61
|
end
|
62
62
|
|
63
|
+
def torrent_set_location(ids, arguments)
|
64
|
+
arguments[:ids] = ids
|
65
|
+
arguments = Transmission::Arguments::LocationSet.new(arguments)
|
66
|
+
@connector.post method: 'torrent-set-location', arguments: arguments.to_arguments
|
67
|
+
end
|
68
|
+
|
63
69
|
def remove_torrent(ids, delete_local_data = false)
|
64
70
|
@connector.post method: 'torrent-remove', arguments: {ids: ids, 'delete-local-data' => delete_local_data}
|
65
71
|
end
|
data/spec/helpers/stubs.rb
CHANGED
@@ -20,6 +20,12 @@ module Stubs
|
|
20
20
|
.to_return(successful_response)
|
21
21
|
end
|
22
22
|
|
23
|
+
def stub_set_location_torrent(body)
|
24
|
+
stub_rpc_request
|
25
|
+
.with(body: torrent_set_location_body(body))
|
26
|
+
.to_return(successful_response)
|
27
|
+
end
|
28
|
+
|
23
29
|
def torrent_get_body(arguments = {})
|
24
30
|
args = {fields: Transmission::Fields::TorrentGet.new.to_fields}.merge(arguments)
|
25
31
|
{method: 'torrent-get', arguments: args}.to_json
|
@@ -37,6 +43,10 @@ module Stubs
|
|
37
43
|
{method: 'torrent-set', arguments: arguments}.to_json
|
38
44
|
end
|
39
45
|
|
46
|
+
def torrent_set_location_body(arguments = {})
|
47
|
+
{method: 'torrent-set-location', arguments: arguments}.to_json
|
48
|
+
end
|
49
|
+
|
40
50
|
def torrent_method_body(method, arguments)
|
41
51
|
{method: method, arguments: arguments}.to_json
|
42
52
|
end
|
@@ -148,6 +148,19 @@ describe Transmission::Model::Torrent do
|
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
+
describe '#set_location' do
|
152
|
+
before :each do
|
153
|
+
Transmission::Config.set
|
154
|
+
stub_get_torrent({ids: [1]}, [{id: 1}])
|
155
|
+
stub_set_location_torrent({location: '/some/location', move: false, ids: [1]})
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'should set a new location' do
|
159
|
+
torrent = Transmission::Model::Torrent.find 1
|
160
|
+
torrent.set_location '/some/location'
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
151
164
|
describe '#delete!' do
|
152
165
|
|
153
166
|
describe 'with configuration' do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'transmission-rpc-ruby'
|
3
|
-
s.version = '0.
|
4
|
-
s.date = '2015-
|
3
|
+
s.version = '0.4.0'
|
4
|
+
s.date = '2015-05-09'
|
5
5
|
s.summary = "Transmission RPC wrapper in Ruby"
|
6
6
|
s.description = "A new transmission RPC wrapper for Ruby. All object oriented for controlling remote transmission daemons."
|
7
7
|
s.authors = ["Max Hoffmann"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transmission-rpc-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Hoffmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- Rakefile
|
85
85
|
- lib/transmission.rb
|
86
86
|
- lib/transmission/arguments.rb
|
87
|
+
- lib/transmission/arguments/location_set.rb
|
87
88
|
- lib/transmission/arguments/session_set.rb
|
88
89
|
- lib/transmission/arguments/torrent_add.rb
|
89
90
|
- lib/transmission/arguments/torrent_set.rb
|