loopiator 0.3.5 → 0.3.6
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/lib/loopiator/client.rb +12 -8
- data/lib/loopiator/configuration.rb +12 -2
- data/lib/loopiator.rb +1 -1
- data/loopiator.gemspec +1 -1
- data/spec/loopiator/configuration_spec.rb +0 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0052de38f588c5ec092a39c1db7c864cca70cce
|
4
|
+
data.tar.gz: 0481091a1d6a62b3f1f60a623d6e15e789abef5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66b943cfe25acd2ae8fed98f0e735e45419f9146ef08de839407a98724d6924d5f3a2a51729d28a2095ae40bf2ad27ce23546edd4849969a54798ab2b4dc0f0c
|
7
|
+
data.tar.gz: 14f432effad1d2f2fcf0190f1e2c931d125804e7a651147bbcf9f5068200b5c12e120c265d609602822a75f2394b109a303a742bb933b677c6fb9ac34e74f9f2
|
data/lib/loopiator/client.rb
CHANGED
@@ -7,15 +7,14 @@ module Loopiator
|
|
7
7
|
|
8
8
|
include Loopiator::Logger
|
9
9
|
|
10
|
-
def initialize(connection_options = {}
|
11
|
-
|
10
|
+
def initialize(connection_options = {})
|
11
|
+
connection_options.symbolize_keys!
|
12
|
+
set_client(connection_options)
|
12
13
|
end
|
13
14
|
|
14
|
-
def set_client(connection_options = {}
|
15
|
-
|
16
|
-
|
17
|
-
self.client = XMLRPC::Client.new_from_hash(connection_options)
|
18
|
-
enable_debugging if debug
|
15
|
+
def set_client(connection_options = {})
|
16
|
+
self.client = XMLRPC::Client.new_from_hash(generate_connection_options(connection_options))
|
17
|
+
enable_debugging if Loopiator.configuration.debug
|
19
18
|
set_client_options(connection_options)
|
20
19
|
end
|
21
20
|
|
@@ -53,7 +52,7 @@ module Loopiator
|
|
53
52
|
private
|
54
53
|
def generate_connection_options(connection_options = {})
|
55
54
|
default_options = {
|
56
|
-
host:
|
55
|
+
host: determine_host(connection_options),
|
57
56
|
path: Loopiator.configuration.path,
|
58
57
|
port: Loopiator.configuration.port,
|
59
58
|
|
@@ -72,6 +71,11 @@ module Loopiator
|
|
72
71
|
default_options.merge(connection_options)
|
73
72
|
end
|
74
73
|
|
74
|
+
def determine_host(connection_options = {})
|
75
|
+
env = (connection_options && !connection_options.empty?) ? connection_options.fetch(:environment, Loopiator.configuration.environment) : Loopiator.configuration.environment
|
76
|
+
Loopiator.configuration.hosts[env.to_sym]
|
77
|
+
end
|
78
|
+
|
75
79
|
def enable_debugging
|
76
80
|
self.client.instance_variable_get(:@http).set_debug_output($stderr)
|
77
81
|
end
|
@@ -1,13 +1,21 @@
|
|
1
1
|
module Loopiator
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :
|
3
|
+
attr_accessor :environment
|
4
|
+
attr_accessor :hosts, :port, :path
|
4
5
|
attr_accessor :auth_user, :auth_password
|
5
6
|
attr_accessor :use_ssl, :timeout
|
7
|
+
attr_accessor :debug
|
6
8
|
attr_accessor :username, :password
|
7
9
|
attr_accessor :proxy_host, :proxy_port, :proxy_user, :proxy_password
|
8
10
|
|
9
11
|
def initialize
|
10
|
-
self.
|
12
|
+
self.environment = :production
|
13
|
+
|
14
|
+
self.hosts = {
|
15
|
+
production: "api.loopia.se",
|
16
|
+
test: "test-api.loopia.se"
|
17
|
+
}
|
18
|
+
|
11
19
|
self.port = 443
|
12
20
|
self.path = "/RPCSERV"
|
13
21
|
|
@@ -17,6 +25,8 @@ module Loopiator
|
|
17
25
|
self.use_ssl = true
|
18
26
|
self.timeout = 180
|
19
27
|
|
28
|
+
self.debug = false
|
29
|
+
|
20
30
|
self.username = nil
|
21
31
|
self.password = nil
|
22
32
|
|
data/lib/loopiator.rb
CHANGED
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.6'
|
7
7
|
|
8
8
|
s.homepage = "https://github.com/Agiley/Loopiator"
|
9
9
|
s.email = "sebastian@agiley.se"
|
@@ -12,10 +12,6 @@ describe "Loopiator Configuration" do
|
|
12
12
|
expect(Loopiator.configuration.password).to be == nil
|
13
13
|
end
|
14
14
|
|
15
|
-
it "should have a default host set" do
|
16
|
-
expect(Loopiator.configuration.host).to be == "api.loopia.se"
|
17
|
-
end
|
18
|
-
|
19
15
|
it "should have a default port set" do
|
20
16
|
expect(Loopiator.configuration.port).to be == 443
|
21
17
|
end
|
@@ -64,10 +60,6 @@ describe "Loopiator Configuration" do
|
|
64
60
|
expect(Loopiator.configuration.proxy_port).to be == 8080
|
65
61
|
end
|
66
62
|
|
67
|
-
it "should have a default host set" do
|
68
|
-
expect(Loopiator.configuration.host).to be == "api.loopia.se"
|
69
|
-
end
|
70
|
-
|
71
63
|
it "should have a default port set" do
|
72
64
|
expect(Loopiator.configuration.port).to be == 443
|
73
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loopiator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Johnsson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simpleidn
|