zabbixapi 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/zabbixapi/base.rb +13 -1
  2. data/zabbixapi.gemspec +1 -1
  3. metadata +2 -3
@@ -32,6 +32,13 @@ module Zabbix
32
32
 
33
33
  @debug = false # Disable debug by default
34
34
  @basic_auth = false #Disable basic_auth by default
35
+
36
+ if ENV['http_proxy'].nil?
37
+ @proxy_uri = URI.parse(ENV['http_proxy'])
38
+ @proxy_host = proxy_uri.host
39
+ @proxy_port = proxy_uri.port
40
+ @proxy_user, proxy_pass = proxy_uri.userinfo.split(/:/) if proxy_uri.userinfo
41
+ end
35
42
  end
36
43
 
37
44
  def do_request(message)
@@ -44,7 +51,12 @@ module Zabbix
44
51
  message_json = JSON.generate(message)
45
52
 
46
53
  uri = URI.parse(@api_url)
47
- http = Net::HTTP.new(uri.host, uri.port)
54
+
55
+ if @proxy_uri.nil?
56
+ http = Net::HTTP.new(uri.host, uri.port)
57
+ else
58
+ http = Net::HTTP.new(uri.host, uri.port, @proxy_host, @proxy_port, @proxy_user, @proxy_pass)
59
+ end
48
60
 
49
61
  if uri.scheme == "https"
50
62
  http.use_ssl = true
data/zabbixapi.gemspec CHANGED
@@ -4,7 +4,7 @@ require 'rake'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
 
7
- spec.version = '0.1.7'
7
+ spec.version = '0.1.8'
8
8
  spec.name = 'zabbixapi'
9
9
  spec.summary = 'Ruby module for work with zabbix api.'
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbixapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-02 00:00:00.000000000 Z
12
+ date: 2012-11-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Ruby module for work with zabbix api v1.8.
15
15
  email: vadv.mkn@gmail.com
@@ -92,4 +92,3 @@ signing_key:
92
92
  specification_version: 3
93
93
  summary: Ruby module for work with zabbix api.
94
94
  test_files: []
95
- has_rdoc: true