zabbix_api_gem 0.3.0 → 0.3.2

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: 2931f6d3227276d1c3120dfc210eae257e5224898a6374964eeb54b7a3644b0d
4
- data.tar.gz: 397ac9e648e3c451bbc3a3334a1672067fbfa4fc271e00dff774bdf103aa8af2
3
+ metadata.gz: a7de442e6ad650043485dca93a827e4bfb5817a1f80bafe113313d0cdfdb2b51
4
+ data.tar.gz: 8df3ba835b144acc50d3f6f455f232c8dc0017a85599dd5894e59444d44d1264
5
5
  SHA512:
6
- metadata.gz: f2daaeb129b09004f106f296cee34f9137ad856b02e60c862697ce66b424ea770b6572cbc169d0b1c46023947988ff38055eed9ee1a56fd723290b8e2809458e
7
- data.tar.gz: 0ea22a6f6b11afa5fd5499aac69bc425bed70a23710a669878a44789ef82aaa8440835bb37254de0144dbdeccc3a337ddae8ee68a2268e08a8cb459102f4c3d9
6
+ metadata.gz: a293a0aabc95d4755d57b9b804f0e9d5c9193efd7ced500fa21241a77499d0ce81dd480ce2640300cf5c52fdfe09ac9f225ab136200c1cd8ad2b7b9faae74605
7
+ data.tar.gz: 417cd8c3bb449e4301f868a614003fe74f1369f2a34b319f1d6fc51609366252c63532a994bc0c2f72b4826a002f27c2008c0f95fe5ad3019e2649b6cd3e53af
data/CHANGELOG.md CHANGED
@@ -9,3 +9,9 @@
9
9
  ## [0.3.0] - 2024-02-20
10
10
  - ConfigurationError raised if not configured properly
11
11
 
12
+ ## [0.3.1] - 2024-02-22
13
+ - Fix problem with entity creation
14
+
15
+ ## [0.3.2] - 2024-03-21
16
+ - Refactory extract method
17
+
data/lib/zabbix/client.rb CHANGED
@@ -11,15 +11,17 @@ module Zabbix
11
11
  self.send(:define_method, method) do |params = nil|
12
12
  rpc_call(rpc_method, params)
13
13
  end
14
- if id_field
15
- # strip trailing 's'
16
- singular = method.to_s.chop.to_sym
17
- self.send(:define_method, singular) do |ids,params = nil|
18
- if ids.is_a?(Array)
19
- rpc_call(rpc_method, {"#{id_field}":ids}.merge(params || {}))
20
- else
21
- rpc_call(rpc_method, {"#{id_field}":[ids]}.merge(params || {})).first
22
- end
14
+
15
+ # singular by stripping last trailing 's'
16
+ self.singular_method(method.to_s.chop.to_sym) if id_field
17
+ end
18
+
19
+ def self.singular_method method
20
+ self.send(:define_method, method) do |ids,params = nil|
21
+ if ids.is_a?(Array)
22
+ rpc_call(rpc_method, {"#{id_field}":ids}.merge(params || {}))
23
+ else
24
+ rpc_call(rpc_method, {"#{id_field}":[ids]}.merge(params || {})).first
23
25
  end
24
26
  end
25
27
  end
@@ -28,7 +28,7 @@ module Zabbix
28
28
  result = post( ZABBIX_ENDPOINT, options )
29
29
  raise RPCError, result.body['error'] if result.body['error']
30
30
 
31
- WrAPI::Request::Entity.new(result.body['result'])
31
+ WrAPI::Request::Entity.create(result.body['result'])
32
32
  end
33
33
 
34
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zabbix
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbix_api_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janco Tanis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-20 00:00:00.000000000 Z
11
+ date: 2024-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  requirements: []
140
- rubygems_version: 3.2.12
140
+ rubygems_version: 3.2.3
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: A Ruby wrapper for the Zabbix APIs (readonly)