sonic 0.1.4 → 0.1.8

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: 40c6ae14c79d9950e205b8bff5082d1d9ec685a0
4
- data.tar.gz: e6fd638deb44a160b1283cca17f1a2a4825ae292
3
+ metadata.gz: 1b6c5652075a03c1f0e63272586097e509bb059f
4
+ data.tar.gz: 6a4ceeacc4d74eb0a001adf4e5dd4db26f8b63ab
5
5
  SHA512:
6
- metadata.gz: ab01ed208a5d9c28e9027e08e37c197125ce6a19a4bbaae01d1f50df203e3ceb252b771c7522a9d2bfb5018900793449b2498c0b4863a8682076404b23f03fd5
7
- data.tar.gz: b17e16c4812c53ec7247798ca6039d9b527d29304d3e0dace0bc4ca9c8c59a820d0cbe22d7e00864f729c6157b0a5b817ed7e54065c9677345791482310bde8b
6
+ metadata.gz: 7d26f4e9bf0b77664af99329fdb56ef2ceb09c228eb58d269bd6e8681e8eec456ad73644c6c1144b4edfa73d16e9d5aadb9b5a19150212d32efebb3186f71333
7
+ data.tar.gz: b1ae123f0960e2d04936a20d75670b299c1cd96b266004b19c3259b4bec1b76a94d9ab9f79ebacdd42db35ad4d0c23c1eb43b7c7f1eabf65651ea96f4410c2e8
@@ -7,18 +7,23 @@ module Sonic
7
7
 
8
8
  def initialize(service_checker)
9
9
  @service_checker = service_checker
10
- port_suffix = service_checker.port ? ":#{service_checker.port}" : ""
11
- @uri = URI.parse("#{service_checker.protocol}://#{service_checker.host}#{port_suffix}/#{service_checker.path}")
10
+ @http = Net::HTTP.new(service_checker.host, service_checker.port)
11
+ if service_checker.protocol == :https
12
+ @http.use_ssl = true
13
+ @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
14
+ end
15
+ @request = Net::HTTP::Get.new(service_checker.path)
12
16
  end
13
17
 
14
18
  def get
15
19
  begin
16
- @service_checker.response = Net::HTTP.get_response(@uri)
17
- case @service_checker.response.code
20
+ response = @http.request(@request)
21
+ @service_checker.response = response.body
22
+ case response.code
18
23
  when '200', '201', '202', '203', '204', '205', '206'
19
24
  true
20
25
  else
21
- @service_checker.error = "service error"
26
+ @service_checker.error = response.error
22
27
  false
23
28
  end
24
29
  rescue Exception => e
@@ -1,3 +1,3 @@
1
1
  module Sonic
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sonic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bulat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-10 00:00:00.000000000 Z
11
+ date: 2016-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -298,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
298
  version: '0'
299
299
  requirements: []
300
300
  rubyforge_project:
301
- rubygems_version: 2.2.2
301
+ rubygems_version: 2.4.5.1
302
302
  signing_key:
303
303
  specification_version: 4
304
304
  summary: Sonic is a Rails Engine status page and services checker.