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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95451fc7e658c3bca0d2af8d254a1530ae1d6d1e8c7aa31ad0e369951b6b77be
4
- data.tar.gz: 7492e578d982244136e98ac7590d3ce4d2dfddca9c842dc65c698f2a90364533
3
+ metadata.gz: ff559203581ff39c2af14b0bd45bd4d79ff213810d1d3b1d4492d6dff8ceb3fa
4
+ data.tar.gz: e8b862dd8a21e7da4ae4b2fa9838ab92581185509d32764f98ff656b73c4cd6e
5
5
  SHA512:
6
- metadata.gz: 6ec9c452afc61f8bf57216397a4b70cf8fe988f08fb39be23f76d7397a0bf1df433b670f6e67c8042ef34aa418cfe88ff473a2b332f1ddc33d93a0918e7e8b7a
7
- data.tar.gz: 766c6154576649165c80f36eaaee92bb0655c614db31f6177b8d2dd8d448531860176dbef20024dbb5cf00ae5bbea22ebfb4c7fbdb5543719520ad835a18d5dd
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 = Net::HTTP.new(uri.host, uri.port)
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
@@ -1,3 +1,3 @@
1
1
  module Restool
2
- VERSION = '1.0.6'
2
+ VERSION = '1.0.7.beta'
3
3
  end
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.6
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-07-17 00:00:00.000000000 Z
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: '0'
108
+ version: 1.3.1
110
109
  requirements: []
111
110
  rubygems_version: 3.2.0.rc.1
112
111
  signing_key:
@@ -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