restool 1.0.6 → 1.0.7.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/restool/service/remote_client.rb +12 -1
- data/lib/restool/version.rb +1 -1
- metadata +4 -5
- data/lib/restool/mock/restool.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff559203581ff39c2af14b0bd45bd4d79ff213810d1d3b1d4492d6dff8ceb3fa
|
4
|
+
data.tar.gz: e8b862dd8a21e7da4ae4b2fa9838ab92581185509d32764f98ff656b73c4cd6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df1c4c75170d4044b029e441179bb1832f38856d320321c3c57b61792d503d1c73b8e7178486213eabb8352c4cf86b2dc3a640b9bc1ce3e4641d57ab928e76cd
|
7
|
+
data.tar.gz: af1557a77df93f47944c16693322e1576c7e3db5dafc23ed875e32f4573adb11d2a9edcd7248699fd2801cef85c210aa8a5e418d23f5795886d2a657095fca6a
|
@@ -25,7 +25,11 @@ module Restool
|
|
25
25
|
def build_connection(host, verify_ssl, timeout, opts)
|
26
26
|
uri = URI.parse(host)
|
27
27
|
|
28
|
-
connection =
|
28
|
+
connection = if proxy_uri
|
29
|
+
Net::HTTP.new(uri.host, uri.port, proxy_uri.host, proxy_uri.port)
|
30
|
+
else
|
31
|
+
Net::HTTP.new(uri.host, uri.port)
|
32
|
+
end
|
29
33
|
|
30
34
|
connection.use_ssl = uri.is_a?(URI::HTTPS)
|
31
35
|
connection.verify_mode = verify_ssl?(verify_ssl)
|
@@ -36,6 +40,13 @@ module Restool
|
|
36
40
|
connection
|
37
41
|
end
|
38
42
|
|
43
|
+
def proxy_uri
|
44
|
+
# Patch for Net/Http issue with env var
|
45
|
+
proxy_env = ENV['http_proxy'] || ENV['HTTP_PROXY']
|
46
|
+
|
47
|
+
URI.parse(proxy_env) if proxy_env != nil && proxy_env != ''
|
48
|
+
end
|
49
|
+
|
39
50
|
def verify_ssl?(verify_ssl_setting)
|
40
51
|
verify_ssl_setting ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
|
41
52
|
end
|
data/lib/restool/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Andres Zeni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -76,7 +76,6 @@ extra_rdoc_files: []
|
|
76
76
|
files:
|
77
77
|
- lib/restool.rb
|
78
78
|
- lib/restool/logger/request_logger.rb
|
79
|
-
- lib/restool/mock/restool.rb
|
80
79
|
- lib/restool/service/operation_definer.rb
|
81
80
|
- lib/restool/service/operation_request.rb
|
82
81
|
- lib/restool/service/remote_client.rb
|
@@ -104,9 +103,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
103
|
version: '0'
|
105
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
105
|
requirements:
|
107
|
-
- - "
|
106
|
+
- - ">"
|
108
107
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
108
|
+
version: 1.3.1
|
110
109
|
requirements: []
|
111
110
|
rubygems_version: 3.2.0.rc.1
|
112
111
|
signing_key:
|
data/lib/restool/mock/restool.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require_relative '../settings/loader'
|
2
|
-
|
3
|
-
module Restool
|
4
|
-
module Mock
|
5
|
-
def self.create(service_name, operation_responses)
|
6
|
-
@operation_responses = operation_responses
|
7
|
-
@service_config = Restool::Settings::Loader.load(service_name)
|
8
|
-
|
9
|
-
Service.new(@service_config, operation_responses)
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
class Service
|
15
|
-
def initialize(service_config, operation_responses)
|
16
|
-
@service_config = service_config
|
17
|
-
@operation_responses = operation_responses
|
18
|
-
end
|
19
|
-
|
20
|
-
def method_missing(method, *args, &block)
|
21
|
-
if @service_config.operations.map(&:name).include?(method)
|
22
|
-
operation_response = @operation_responses[method]
|
23
|
-
response_representation = @service_config.operation.response
|
24
|
-
representations = @service_config.representations
|
25
|
-
|
26
|
-
Restool::Traversal::Converter.convert(operation_response, response_representation, representations)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|