loopiator 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be4bd53de4c331058e0fb971f6a7d477baecb6a7
4
- data.tar.gz: e5029296588dafd6edca92795e71760f7e0a71b6
3
+ metadata.gz: a22381d3161f16684001d0698639a1d41853bc4d
4
+ data.tar.gz: ef2c2bd4aae92301225c9cbfecdcd92d0a809bde
5
5
  SHA512:
6
- metadata.gz: 8e8cd80be4a4918de47322b4de7b8f405f981dca9f3ec46bf3ca3624338452e458ede843326f4baa73e898d373bff572c31d5d84d2082ce78f2e809459bb8bec
7
- data.tar.gz: 6db744b565eb45dbb941199652cbfbf2ce3b5d0efcfec78ebc6dba0d5f632b907c02e79e1909464a6bb640819a9b2e409949620c78900692b09359f120c5fb02
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.0"
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 = Configuration.new
24
+ @configuration = nil
25
25
  end
26
26
 
27
27
  def self.configure
28
- yield(self.configuration)
28
+ yield(configuration)
29
29
  end
30
30
 
31
31
  end
@@ -7,14 +7,15 @@ module Loopiator
7
7
 
8
8
  include Loopiator::Logger
9
9
 
10
- def initialize(connection_options = nil)
10
+ def initialize(connection_options = {})
11
11
  set_client(connection_options)
12
12
  end
13
13
 
14
- def set_client(connection_options = nil)
15
- self.client = XMLRPC::Client.new_from_hash(generate_connection_options(connection_options))
16
- self.client.instance_variable_get(:@http).instance_variable_set(:@verify_mode, OpenSSL::SSL::VERIFY_NONE)
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 = nil)
53
- connection_options ||= {
54
- host: Loopiator.configuration.host,
55
- path: Loopiator.configuration.path,
56
- port: Loopiator.configuration.port,
57
- use_ssl: Loopiator.configuration.use_ssl,
58
- timeout: Loopiator.configuration.timeout,
59
- proxy_host: Loopiator.configuration.proxy_host,
60
- proxy_port: Loopiator.configuration.proxy_port,
61
- user: Loopiator.configuration.proxy_user,
62
- password: Loopiator.configuration.proxy_password,
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.0'
6
+ s.version = '0.3.1'
7
7
 
8
8
  s.homepage = "https://github.com/Agiley/Loopiator"
9
9
  s.email = "sebastian@agiley.se"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loopiator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Johnsson