zabbix-client 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d5585021d980030d1b89a8c14c701cd1dd1f84c
4
- data.tar.gz: a23f3b6127ee92b0aae5380e247d2b82651618b8
3
+ metadata.gz: 37cf81b7ef3559cfb4199eea0338d1990e9b52d2
4
+ data.tar.gz: 544d6f8d3d8fd360729b5352a2af0a316a7e5e45
5
5
  SHA512:
6
- metadata.gz: be8bce17e565303c4aa7139c35f8c8ca013dc4747b14edf5aedd6a2834b651cd6bacb2f2079dc1147660660349fe810385d36211f2f037eb712e21b4c6c7220f
7
- data.tar.gz: 036c4bec2b878d72e7823955637d4025a6c4eb83e46f3f4052b97d07d868c5189381314b82c98775770f6443d48b61d1fa4d7219b1ef3b0f1d5219349bb98079
6
+ metadata.gz: 91e85581088aa200d91b1daba210937237e103cb13db5198d689a8bb2089359155adef63f7d2f750db9379ebf65d82531337df06f5ff0b5e30f1d83161e83185
7
+ data.tar.gz: 68199bc81acba251c13a1b8da97780d462b839600ca458c5de1024f654d61c7e58fbe6efd5bae93c5d8a1576b2b472cac6b0fc8078a7247837757f37a61f51f1
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This is a simple client of Zabbix API.
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/zabbix-client.svg)](http://badge.fury.io/rb/zabbix-client)
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -42,7 +44,7 @@ p client.template.getobjects(host: ['Template OS Linux'])
42
44
  ### Use proxy
43
45
 
44
46
  ```ruby
45
- client = Zabbix::Client.new(
47
+ Zabbix::Client.new(
46
48
  'http://localhost/zabbix/api_jsonrpc.php',
47
49
  proxy_user: 'username', proxy_password: 'password'
48
50
  )
@@ -51,7 +53,7 @@ client = Zabbix::Client.new(
51
53
  ### Basic auth
52
54
 
53
55
  ```ruby
54
- client = Zabbix::Client.new(
56
+ Zabbix::Client.new(
55
57
  'http://localhost/zabbix/api_jsonrpc.php',
56
58
  basic_auth_user: 'username', basic_auth_password: 'password'
57
59
  )
@@ -60,7 +62,7 @@ client = Zabbix::Client.new(
60
62
  ### Debug mode
61
63
 
62
64
  ```ruby
63
- client = Zabbix::Client.new(
65
+ Zabbix::Client.new(
64
66
  'http://localhost/zabbix/api_jsonrpc.php',
65
67
  debug: true
66
68
  )
@@ -6,6 +6,11 @@ class Zabbix::Client
6
6
  LOGIN_METHOD = 'user.login'
7
7
  LOGOUT_METHOD = 'user.logout'
8
8
 
9
+ UNAUTHENTICATED_METHODS = [
10
+ 'user.login',
11
+ 'apiinfo.version',
12
+ ]
13
+
9
14
  DEFAULT_HEADERS = {
10
15
  'Content-Type' => 'application/json-rpc'
11
16
  }
@@ -54,7 +59,10 @@ class Zabbix::Client
54
59
  :id => JSON_RPC_REQUEST_ID,
55
60
  }.merge(options)
56
61
 
57
- body[:auth] = @client.auth if @client.auth
62
+ if @client.auth and not UNAUTHENTICATED_METHODS.include?(method)
63
+ body[:auth] = @client.auth
64
+ end
65
+
58
66
  body = JSON.dump(body)
59
67
 
60
68
  proxy_user = @client.options[:proxy_user]
@@ -1,5 +1,5 @@
1
1
  module Zabbix
2
2
  class Client
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbix-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara