loopiator 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/loopiator.rb +3 -3
- data/lib/loopiator/client.rb +34 -16
- data/lib/loopiator/configuration.rb +4 -0
- data/loopiator.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a22381d3161f16684001d0698639a1d41853bc4d
|
4
|
+
data.tar.gz: ef2c2bd4aae92301225c9cbfecdcd92d0a809bde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4357a9e50c4370c21beaf1a7352a47d40727e0c24f2bed6b1357405e0996e605f71f361510df44bb1a4219096f85dd713964a17fc446fb151df076ffc7fe8523
|
7
|
+
data.tar.gz: 5e97236721b61dc55f6eacd418ce449389a0d607e2880777482c637e8065e6bab74839e9c552638f687f5868c197ebaabf8cd49febe35d70e707f87930193756
|
data/lib/loopiator.rb
CHANGED
@@ -10,7 +10,7 @@ require File.join(File.dirname(__FILE__), 'loopiator/credits')
|
|
10
10
|
require File.join(File.dirname(__FILE__), 'loopiator/client')
|
11
11
|
|
12
12
|
module Loopiator
|
13
|
-
VERSION = "0.3.
|
13
|
+
VERSION = "0.3.1"
|
14
14
|
|
15
15
|
class << self
|
16
16
|
attr_writer :configuration
|
@@ -21,11 +21,11 @@ module Loopiator
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.reset
|
24
|
-
@configuration =
|
24
|
+
@configuration = nil
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.configure
|
28
|
-
yield(
|
28
|
+
yield(configuration)
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
data/lib/loopiator/client.rb
CHANGED
@@ -7,14 +7,15 @@ module Loopiator
|
|
7
7
|
|
8
8
|
include Loopiator::Logger
|
9
9
|
|
10
|
-
def initialize(connection_options =
|
10
|
+
def initialize(connection_options = {})
|
11
11
|
set_client(connection_options)
|
12
12
|
end
|
13
13
|
|
14
|
-
def set_client(connection_options =
|
15
|
-
|
16
|
-
|
17
|
-
self.client
|
14
|
+
def set_client(connection_options = {})
|
15
|
+
connection_options = generate_connection_options(connection_options)
|
16
|
+
|
17
|
+
self.client = XMLRPC::Client.new_from_hash(connection_options)
|
18
|
+
set_client_options(connection_options)
|
18
19
|
end
|
19
20
|
|
20
21
|
def call(rpc_method, *args)
|
@@ -49,18 +50,35 @@ module Loopiator
|
|
49
50
|
include Loopiator::Credits
|
50
51
|
|
51
52
|
private
|
52
|
-
def generate_connection_options(connection_options =
|
53
|
-
|
54
|
-
host:
|
55
|
-
path:
|
56
|
-
port:
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
53
|
+
def generate_connection_options(connection_options = {})
|
54
|
+
default_options = {
|
55
|
+
host: Loopiator.configuration.host,
|
56
|
+
path: Loopiator.configuration.path,
|
57
|
+
port: Loopiator.configuration.port,
|
58
|
+
|
59
|
+
user: Loopiator.configuration.auth_user,
|
60
|
+
password: Loopiator.configuration.auth_password,
|
61
|
+
|
62
|
+
use_ssl: Loopiator.configuration.use_ssl,
|
63
|
+
timeout: Loopiator.configuration.timeout,
|
64
|
+
|
65
|
+
proxy_host: Loopiator.configuration.proxy_host,
|
66
|
+
proxy_port: Loopiator.configuration.proxy_port,
|
67
|
+
proxy_user: Loopiator.configuration.proxy_user,
|
68
|
+
proxy_password: Loopiator.configuration.proxy_password,
|
63
69
|
}
|
70
|
+
|
71
|
+
default_options.merge(connection_options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def set_client_options(connection_options = {})
|
75
|
+
self.client.instance_variable_get(:@http).instance_variable_set(:@verify_mode, OpenSSL::SSL::VERIFY_NONE)
|
76
|
+
|
77
|
+
#Seems to be the only way to set the proxy user / password for Ruby's XMLRPC?
|
78
|
+
proxy_user = connection_options.fetch(:proxy_user, nil)
|
79
|
+
proxy_password = connection_options.fetch(:proxy_password, nil)
|
80
|
+
self.client.instance_variable_get(:@http).instance_variable_set(:@proxy_user, proxy_user) if (proxy_user && !proxy_user.empty?)
|
81
|
+
self.client.instance_variable_get(:@http).instance_variable_set(:@proxy_pass, proxy_password) if (proxy_password && !proxy_password.empty?)
|
64
82
|
end
|
65
83
|
|
66
84
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Loopiator
|
2
2
|
class Configuration
|
3
3
|
attr_accessor :host, :port, :path
|
4
|
+
attr_accessor :auth_user, :auth_password
|
4
5
|
attr_accessor :use_ssl, :timeout
|
5
6
|
attr_accessor :username, :password
|
6
7
|
attr_accessor :proxy_host, :proxy_port, :proxy_user, :proxy_password
|
@@ -10,6 +11,9 @@ module Loopiator
|
|
10
11
|
self.port = 443
|
11
12
|
self.path = "/RPCSERV"
|
12
13
|
|
14
|
+
self.auth_user = nil
|
15
|
+
self.auth_password = nil
|
16
|
+
|
13
17
|
self.use_ssl = true
|
14
18
|
self.timeout = 180
|
15
19
|
|
data/loopiator.gemspec
CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
|
4
4
|
|
5
5
|
s.name = 'loopiator'
|
6
|
-
s.version = '0.3.
|
6
|
+
s.version = '0.3.1'
|
7
7
|
|
8
8
|
s.homepage = "https://github.com/Agiley/Loopiator"
|
9
9
|
s.email = "sebastian@agiley.se"
|