heartcheck-webservice 1.1.0 → 1.2.0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4aa666913efcada0341d6151bc41d38a2cbe63a4
|
4
|
+
data.tar.gz: 6729a0c04654b0e3da26b1e51292cf9607319649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ca3cb3fa2a895403ca0e84b9c2625367ed65ce80ba55d421790cbe95565c3bc8b87171c7692ced56b3879c8e890901ad4c7a3b4856bc313375171b71dcac0d3
|
7
|
+
data.tar.gz: 5f595137b7a1cb0c533e63e8b40a693bce902505b208ce2e8560f2e5405382738ab08bd43eb6abe4fc531dd0ca3c32080024e5f3e8a24c1ffcb0681d09861cf4
|
@@ -80,7 +80,9 @@ module Heartcheck
|
|
80
80
|
# @return [Net:HTTP]
|
81
81
|
def request_for(service)
|
82
82
|
Heartcheck::Webservice::HttpClient.new(service[:url],
|
83
|
-
service[:
|
83
|
+
service[:proxy],
|
84
|
+
service[:ignore_ssl_cert],
|
85
|
+
service[:headers]).get
|
84
86
|
end
|
85
87
|
end
|
86
88
|
end
|
@@ -3,17 +3,34 @@ module Heartcheck
|
|
3
3
|
module Webservice
|
4
4
|
# Http Client
|
5
5
|
class HttpClient
|
6
|
-
attr_reader :uri, :http
|
6
|
+
attr_reader :uri, :http, :proxy, :headers, :request
|
7
7
|
|
8
|
-
def initialize(url, ignore_ssl_cert)
|
9
|
-
@uri = URI
|
10
|
-
@
|
8
|
+
def initialize(url, proxy, ignore_ssl_cert, headers)
|
9
|
+
@uri = URI(url)
|
10
|
+
@headers = headers || {}
|
11
|
+
@proxy = URI(proxy) if proxy
|
12
|
+
|
13
|
+
@http = Net::HTTP.new(@uri.host, @uri.port, proxy_host, proxy_port)
|
11
14
|
@http.use_ssl = @uri.scheme == 'https'
|
12
15
|
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE if ignore_ssl_cert
|
13
16
|
end
|
14
17
|
|
15
18
|
def get
|
16
|
-
|
19
|
+
@request = Net::HTTP::Get.new(uri.request_uri)
|
20
|
+
|
21
|
+
headers.each { |k, v| request[k] = v }
|
22
|
+
|
23
|
+
http.request request
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def proxy_host
|
29
|
+
proxy.host if proxy
|
30
|
+
end
|
31
|
+
|
32
|
+
def proxy_port
|
33
|
+
proxy.port if proxy
|
17
34
|
end
|
18
35
|
end
|
19
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heartcheck-webservice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Locaweb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: heartcheck
|