transmission-simple 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/lib/transmission-simple.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'net/http'
|
3
|
+
require 'openssl'
|
3
4
|
require 'net/https'
|
4
5
|
require 'uri'
|
5
6
|
require 'json'
|
@@ -8,4 +9,5 @@ require 'active_support/inflector'
|
|
8
9
|
|
9
10
|
require 'transmission-simple/error'
|
10
11
|
require 'transmission-simple/torrent'
|
11
|
-
require 'transmission-simple/api'
|
12
|
+
require 'transmission-simple/api'
|
13
|
+
|
@@ -8,7 +8,9 @@ module TransmissionSimple
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def send_request(request_name, options )
|
11
|
-
http = Net::HTTP.new(endpoint.host, endpoint.port)
|
11
|
+
http = Net::HTTP.new(endpoint.host, endpoint.port)
|
12
|
+
http.use_ssl = ( endpoint.scheme == 'https' )
|
13
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
12
14
|
# http.set_debug_output STDOUT
|
13
15
|
http.start do |http|
|
14
16
|
request = Net::HTTP::Post.new(endpoint.path, {'X-Transmission-Session-Id' => (session or ''), 'Content-Type' => 'application/json' })
|
@@ -36,7 +38,7 @@ module TransmissionSimple
|
|
36
38
|
{}
|
37
39
|
end
|
38
40
|
else
|
39
|
-
raise
|
41
|
+
raise TransmissionSimple::Error.new( json_results['result'] )
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jon Moses
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-12-14 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|