zabbix-api-simple 0.1.4 → 0.2.1

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: 83cbdecabffb3046fa59ff7ea1a9efb65142a16ca9da0f137f26b9397b0ead51
4
- data.tar.gz: '05248676c6c183f45d84dcddc96a77b8f648e9e8ee7cb72cf8a25857fa65f5a5'
3
+ metadata.gz: 46064cab99de1a18915c05f63d2101160a28ef67a4d6c32b612e1467894b1fa6
4
+ data.tar.gz: 8dff176c2e45d4a440344af791faa95b9d4f99b77bc8da215fb9341a3db6b6cc
5
5
  SHA512:
6
- metadata.gz: b4eb92bcf16a9417ebe88ce91c84fea41855993d2f4e4f6b3b6df5f9a1783c7fb4c9260fe877d94f31eacdfe857a6f7c95294725d479b7ea1806f109432bb49e
7
- data.tar.gz: 344de35efbf3c28ed1bbcb7e0ed7724709bec88233edb260ba617f4c3b2575bf7366a4c239f3e7a2c4c0c57a1fd284b3486dfb9ea49b4a93d593d3a9d0c5d81f
6
+ metadata.gz: 8fc06be35eac88c1566c6b6d4a3735f69feec302506173a1c491d3e11fc43d51fe9c291bd5be34eed8e2d5bea215f99e01b96da187d402e2fa627fe01300609b
7
+ data.tar.gz: 39fe035780ffa88b348a8d77ee50fa94a94607d0f82ea4e240874de7be3e6787023ee0f3e9d3617ac201cd625cc19be6387a013cedfa2613c05ff5d23ab25960
data/CHANGELOG.md CHANGED
@@ -1,2 +1,15 @@
1
1
  # 0.1.4
2
2
  - Just doc changes
3
+ # 0.1.5
4
+ - deps fix for pry
5
+ - add known_objects method
6
+ - add exception trap for json parse issues w/ note about php memory
7
+ - change zapishell.rb to start in the api context
8
+ - add exception for apiinfo.version (refuses auth token for some reason)
9
+ - add pretty inspection mode to zapishell.rb
10
+ # 0.1.6
11
+ - force faraday 1.8 - 2.0 appears to break things
12
+ # 0.2.0
13
+ - changes to support faraday 2.0. Note that faraday < 2.0 is incompatible with 2.0+ - when you install zabbix-api-simple 0.2.0 it will install faraday 2.0
14
+ # 0.2.1
15
+ - another faraday fix
data/README.md CHANGED
@@ -36,6 +36,8 @@ Once you have an authenticated instance of the client, syntax is basically alway
36
36
 
37
37
  `clientinstance.object.verb(<param kv pairs>)`
38
38
 
39
+ ![simple translation](images/zabbix-api-simple-simplicity.png)
40
+
39
41
  If "object" is unknown, "Unknown zabbix object given" will be raised.
40
42
 
41
43
  If this call results in an error from the API, a RuntimeError will be raised indicating the specifics.
@@ -106,12 +108,6 @@ It attempts to authenticate you to the given server, and then drops you to a pry
106
108
 
107
109
  Refer to the API documentation for your version of Zabbix for the particulars.
108
110
 
109
- ## Development
110
-
111
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
112
-
113
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
114
-
115
111
  ## Contributing
116
112
 
117
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/zabbix-api.
113
+ Bug reports and pull requests are welcome on GitLab at https://gitlab.com/svdasein/zabbix-api
data/exe/zapishell.rb CHANGED
@@ -12,12 +12,26 @@ opts = Optimist::options do
12
12
  opt :pass, "Pass to auth user with", type: :string, required: true
13
13
  end
14
14
 
15
+
16
+
17
+ Zabbix::Api::OpenStruct.prettymode = true
18
+
15
19
  print "user.login: "
16
20
  api = Zabbix::Api::Client.new(url: opts[:url])
17
21
 
18
22
  ap api.login(user: opts[:user],pass:opts[:pass])
19
23
 
20
- binding.pry
24
+ puts <<-END
25
+
26
+ Enter api commands e.g. host.get
27
+
28
+ execute known_objects for a list of known zabbix object types
29
+
30
+ quit to exit - your session will be logged out for you
31
+
32
+ END
33
+
34
+ api.pry
21
35
 
22
36
  print "user.logout: "
23
37
  ap api.logout
Binary file
Binary file
@@ -2,8 +2,10 @@ module Zabbix
2
2
  module Api
3
3
 
4
4
  require 'faraday'
5
+ require 'faraday/net_http'
5
6
  require 'json'
6
7
  require 'set'
8
+ require 'amazing_print'
7
9
  require 'pry'
8
10
 
9
11
  module FaradayMiddleware
@@ -26,16 +28,55 @@ module Zabbix
26
28
  end
27
29
 
28
30
  def on_complete(env)
29
- env[:response_body] = JSON.parse(env[:response_body])
31
+ begin
32
+ env[:response_body] = JSON.parse(env[:response_body])
33
+ rescue JSON::ParserError => e
34
+ env[:response_body] = {error: e,note: 'Check api web configuration (e.g. url, PHP memory, etc)'}
35
+ end
30
36
  end
31
37
 
32
38
  end
33
39
 
34
- Faraday::Request.register_middleware zabbix_api_request: -> { ZabbixApiRequest }
40
+ Faraday::Request.register_middleware(zabbix_api_request: ZabbixApiRequest)
35
41
 
36
42
  end # module FaradayMiddleware
37
43
 
38
44
 
45
+
46
+ ##
47
+ # Subclass of OpenStruct adds some niceties for REPL etc
48
+ #
49
+ class OpenStruct < OpenStruct
50
+
51
+ ##
52
+ # If true, inspect returns awesome_inspect instead of default
53
+ @@prettymode = false
54
+
55
+ class << self
56
+ ##
57
+ # returns current value of prettymode
58
+ #
59
+ def prettymode
60
+ @@prettymode
61
+ end
62
+ ##
63
+ # sets prettymod to aBool
64
+ #
65
+ def prettymode=(aBool)
66
+ @@prettymode = aBool
67
+ end
68
+ end
69
+
70
+ def inspect
71
+ if @@prettymode
72
+ awesome_inspect
73
+ else
74
+ super
75
+ end
76
+ end
77
+
78
+ end
79
+
39
80
  ##
40
81
  # Each instance of this class acts as a connection Zabbix's API
41
82
  class Client
@@ -73,6 +114,7 @@ module Zabbix
73
114
  # happen automagically. You can alter request timeout if needed by passing
74
115
  # :timeout - the default is 60 secs
75
116
  def initialize(url: nil,timeout: 60)
117
+ Faraday.default_adapter = :net_http
76
118
  @conn = Faraday.new(
77
119
  url: url,
78
120
  headers: {'Content-Type' => 'application/json-rpc'},
@@ -120,7 +162,12 @@ module Zabbix
120
162
  # results are returned as instances of OpenStruct. If you need this to be
121
163
  # a hash just do to_h to the returned object.
122
164
  def call(name, *args, &block)
165
+ res = nil
166
+ if name == 'apiinfo.version'
167
+ res = post(method: "#{name}", params: args.first, id: '1').body
168
+ else
123
169
  res = post(method: "#{name}", params: args.first, id: '1', auth: @token).body
170
+ end
124
171
  raise res['error'].awesome_inspect(plain: true) if res.has_key?('error')
125
172
  if res.has_key?('result') and res['result'].class == Array
126
173
  res = res['result'].collect{|each| OpenStruct.new(each)}
@@ -130,6 +177,14 @@ module Zabbix
130
177
  return res
131
178
  end
132
179
 
180
+ ##
181
+ # just handy if you're doing a REPL (e.g. zapishell.rb) Returns
182
+ # list of zabbix objects the api currently is aware of
183
+ #
184
+ def known_objects
185
+ @@zabbix_objects
186
+ end
187
+
133
188
 
134
189
  ##
135
190
  # this override of method_missing is the trick that lets zabbix-api-simple
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Zabbix
4
4
  module Api
5
- VERSION = "0.1.4"
5
+ VERSION = "0.2.1"
6
6
  end
7
7
  end
data/lib/zabbix/api.rb CHANGED
@@ -3,9 +3,3 @@
3
3
  require_relative "api/version"
4
4
  require_relative "api/client"
5
5
 
6
- module Zabbix
7
- module Api
8
- class Error < StandardError; end
9
- # Your code goes here...
10
- end
11
- end
@@ -335,6 +335,30 @@
335
335
  <p>:url is required.</p>
336
336
  </div></span>
337
337
 
338
+ </li>
339
+
340
+
341
+ <li class="public ">
342
+ <span class="summary_signature">
343
+
344
+ <a href="#known_objects-instance_method" title="#known_objects (instance method)">#<strong>known_objects</strong> &#x21d2; Object </a>
345
+
346
+
347
+
348
+ </span>
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+ <span class="summary_desc"><div class='inline'>
359
+ <p>just handy if you&#39;re doing a REPL (e.g. zapishell.rb) Returns list of zabbix objects the api currently is aware of.</p>
360
+ </div></span>
361
+
338
362
  </li>
339
363
 
340
364
 
@@ -490,19 +514,19 @@
490
514
  <pre class="lines">
491
515
 
492
516
 
493
- 75
494
- 76
495
- 77
496
- 78
497
- 79
498
- 80
499
- 81
500
- 82
501
- 83
502
- 84</pre>
517
+ 115
518
+ 116
519
+ 117
520
+ 118
521
+ 119
522
+ 120
523
+ 121
524
+ 122
525
+ 123
526
+ 124</pre>
503
527
  </td>
504
528
  <td>
505
- <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 75</span>
529
+ <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 115</span>
506
530
 
507
531
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>url:</span> <span class='kw'>nil</span><span class='comma'>,</span><span class='label'>timeout:</span> <span class='int'>60</span><span class='rparen'>)</span>
508
532
  <span class='ivar'>@conn</span> <span class='op'>=</span> <span class='const'>Faraday</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
@@ -555,23 +579,23 @@
555
579
  <pre class="lines">
556
580
 
557
581
 
558
- 143
559
- 144
560
- 145
561
- 146
562
- 147
563
- 148
564
- 149
565
- 150
566
- 151
567
- 152
568
- 153
569
- 154
570
- 155
571
- 156</pre>
582
+ 196
583
+ 197
584
+ 198
585
+ 199
586
+ 200
587
+ 201
588
+ 202
589
+ 203
590
+ 204
591
+ 205
592
+ 206
593
+ 207
594
+ 208
595
+ 209</pre>
572
596
  </td>
573
597
  <td>
574
- <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 143</span>
598
+ <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 196</span>
575
599
 
576
600
  <span class='kw'>def</span> <span class='id identifier rubyid_method_missing'>method_missing</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
577
601
  <span class='kw'>if</span> <span class='cvar'>@@zabbix_objects</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
@@ -625,12 +649,12 @@
625
649
  <pre class="lines">
626
650
 
627
651
 
628
- 44
629
- 45
630
- 46</pre>
652
+ 84
653
+ 85
654
+ 86</pre>
631
655
  </td>
632
656
  <td>
633
- <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 44</span>
657
+ <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 84</span>
634
658
 
635
659
  <span class='kw'>def</span> <span class='id identifier rubyid_last'>last</span>
636
660
  <span class='ivar'>@last</span>
@@ -673,12 +697,12 @@
673
697
  <pre class="lines">
674
698
 
675
699
 
676
- 67
677
- 68
678
- 69</pre>
700
+ 107
701
+ 108
702
+ 109</pre>
679
703
  </td>
680
704
  <td>
681
- <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 67</span>
705
+ <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 107</span>
682
706
 
683
707
  <span class='kw'>def</span> <span class='id identifier rubyid_conn'>conn</span>
684
708
  <span class='ivar'>@conn</span>
@@ -716,12 +740,12 @@
716
740
  <pre class="lines">
717
741
 
718
742
 
719
- 67
720
- 68
721
- 69</pre>
743
+ 107
744
+ 108
745
+ 109</pre>
722
746
  </td>
723
747
  <td>
724
- <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 67</span>
748
+ <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 107</span>
725
749
 
726
750
  <span class='kw'>def</span> <span class='id identifier rubyid_token'>token</span>
727
751
  <span class='ivar'>@token</span>
@@ -759,12 +783,12 @@
759
783
  <pre class="lines">
760
784
 
761
785
 
762
- 68
763
- 69
764
- 70</pre>
786
+ 108
787
+ 109
788
+ 110</pre>
765
789
  </td>
766
790
  <td>
767
- <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 68</span>
791
+ <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 108</span>
768
792
 
769
793
  <span class='kw'>def</span> <span class='id identifier rubyid_zabobject'>zabobject</span>
770
794
  <span class='ivar'>@zabobject</span>
@@ -809,33 +833,84 @@
809
833
  <pre class="lines">
810
834
 
811
835
 
812
- 122
813
- 123
814
- 124
815
- 125
816
- 126
817
- 127
818
- 128
819
- 129
820
- 130
821
- 131</pre>
836
+ 162
837
+ 163
838
+ 164
839
+ 165
840
+ 166
841
+ 167
842
+ 168
843
+ 169
844
+ 170
845
+ 171
846
+ 172
847
+ 173
848
+ 174
849
+ 175
850
+ 176</pre>
822
851
  </td>
823
852
  <td>
824
- <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 122</span>
853
+ <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 162</span>
825
854
 
826
855
  <span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
856
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='kw'>nil</span>
857
+ <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>apiinfo.version</span><span class='tstring_end'>&#39;</span></span>
858
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='label'>method:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>params:</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='comma'>,</span> <span class='label'>id:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>1</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span>
859
+ <span class='kw'>else</span>
827
860
  <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='label'>method:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>params:</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='comma'>,</span> <span class='label'>id:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>1</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>auth:</span> <span class='ivar'>@token</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span>
861
+ <span class='kw'>end</span>
828
862
  <span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>error</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_awesome_inspect'>awesome_inspect</span><span class='lparen'>(</span><span class='label'>plain:</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>error</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
829
863
  <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>result</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>and</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>result</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'>Array</span>
830
- <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>result</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_each'>each</span><span class='op'>|</span> <span class='const'>OpenStruct</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_each'>each</span><span class='rparen'>)</span><span class='rbrace'>}</span>
864
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>result</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_each'>each</span><span class='op'>|</span> <span class='const'><span class='object_link'><a href="OpenStruct.html" title="Zabbix::Api::OpenStruct (class)">OpenStruct</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_each'>each</span><span class='rparen'>)</span><span class='rbrace'>}</span>
831
865
  <span class='kw'>else</span>
832
- <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>OpenStruct</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='rparen'>)</span>
866
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="OpenStruct.html" title="Zabbix::Api::OpenStruct (class)">OpenStruct</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='rparen'>)</span>
833
867
  <span class='kw'>end</span>
834
868
  <span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span>
835
869
  <span class='kw'>end</span></pre>
836
870
  </td>
837
871
  </tr>
838
872
  </table>
873
+ </div>
874
+
875
+ <div class="method_details ">
876
+ <h3 class="signature " id="known_objects-instance_method">
877
+
878
+ #<strong>known_objects</strong> &#x21d2; <tt>Object</tt>
879
+
880
+
881
+
882
+
883
+
884
+ </h3><div class="docstring">
885
+ <div class="discussion">
886
+
887
+ <p>just handy if you&#39;re doing a REPL (e.g. zapishell.rb) Returns list of zabbix objects the api currently is aware of</p>
888
+
889
+
890
+ </div>
891
+ </div>
892
+ <div class="tags">
893
+
894
+
895
+ </div><table class="source_code">
896
+ <tr>
897
+ <td>
898
+ <pre class="lines">
899
+
900
+
901
+ 182
902
+ 183
903
+ 184</pre>
904
+ </td>
905
+ <td>
906
+ <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 182</span>
907
+
908
+ <span class='kw'>def</span> <span class='id identifier rubyid_known_objects'>known_objects</span>
909
+ <span class='cvar'>@@zabbix_objects</span>
910
+ <span class='kw'>end</span></pre>
911
+ </td>
912
+ </tr>
913
+ </table>
839
914
  </div>
840
915
 
841
916
  <div class="method_details ">
@@ -864,12 +939,12 @@
864
939
  <pre class="lines">
865
940
 
866
941
 
867
- 160
868
- 161
869
- 162</pre>
942
+ 213
943
+ 214
944
+ 215</pre>
870
945
  </td>
871
946
  <td>
872
- <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 160</span>
947
+ <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 213</span>
873
948
 
874
949
  <span class='kw'>def</span> <span class='id identifier rubyid_last'>last</span>
875
950
  <span class='const'><span class='object_link'><a href="" title="Zabbix::Api::Client (class)">Client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_last'><span class='object_link'><a href="#last-class_method" title="Zabbix::Api::Client.last (method)">last</a></span></span>
@@ -905,19 +980,19 @@
905
980
  <pre class="lines">
906
981
 
907
982
 
908
- 99
909
- 100
910
- 101
911
- 102
912
- 103</pre>
983
+ 139
984
+ 140
985
+ 141
986
+ 142
987
+ 143</pre>
913
988
  </td>
914
989
  <td>
915
- <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 99</span>
990
+ <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 139</span>
916
991
 
917
992
  <span class='kw'>def</span> <span class='id identifier rubyid_login'>login</span><span class='lparen'>(</span><span class='label'>user:</span> <span class='kw'>nil</span><span class='comma'>,</span><span class='label'>pass:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
918
993
  <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='label'>method:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>user.login</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>params:</span> <span class='lbrace'>{</span><span class='label'>user:</span> <span class='id identifier rubyid_user'>user</span><span class='comma'>,</span> <span class='label'>password:</span><span class='id identifier rubyid_pass'>pass</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>auth:</span><span class='kw'>nil</span><span class='rparen'>)</span>
919
994
  <span class='ivar'>@token</span> <span class='op'>=</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>result</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
920
- <span class='const'>OpenStruct</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
995
+ <span class='const'><span class='object_link'><a href="OpenStruct.html" title="Zabbix::Api::OpenStruct (class)">OpenStruct</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
921
996
  <span class='kw'>end</span></pre>
922
997
  </td>
923
998
  </tr>
@@ -950,15 +1025,15 @@
950
1025
  <pre class="lines">
951
1026
 
952
1027
 
953
- 110
954
- 111
955
- 112</pre>
1028
+ 150
1029
+ 151
1030
+ 152</pre>
956
1031
  </td>
957
1032
  <td>
958
- <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 110</span>
1033
+ <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 150</span>
959
1034
 
960
1035
  <span class='kw'>def</span> <span class='id identifier rubyid_logout'>logout</span>
961
- <span class='const'>OpenStruct</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='label'>method:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>user.logout</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>params:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>auth:</span> <span class='ivar'>@token</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
1036
+ <span class='const'><span class='object_link'><a href="OpenStruct.html" title="Zabbix::Api::OpenStruct (class)">OpenStruct</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='label'>method:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>user.logout</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>params:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>auth:</span> <span class='ivar'>@token</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
962
1037
  <span class='kw'>end</span></pre>
963
1038
  </td>
964
1039
  </tr>
@@ -991,15 +1066,15 @@
991
1066
  <pre class="lines">
992
1067
 
993
1068
 
994
- 89
995
- 90
996
- 91
997
- 92
998
- 93
999
- 94</pre>
1069
+ 129
1070
+ 130
1071
+ 131
1072
+ 132
1073
+ 133
1074
+ 134</pre>
1000
1075
  </td>
1001
1076
  <td>
1002
- <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 89</span>
1077
+ <pre class="code"><span class="info file"># File 'lib/zabbix/api/client.rb', line 129</span>
1003
1078
 
1004
1079
  <span class='kw'>def</span> <span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
1005
1080
  <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='symbol'>:params</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='kw'>not</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:params</span><span class='rparen'>)</span> <span class='kw'>or</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='symbol'>:params</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
@@ -1017,7 +1092,7 @@
1017
1092
  </div>
1018
1093
 
1019
1094
  <div id="footer">
1020
- Generated on Sat Sep 11 20:08:37 2021 by
1095
+ Generated on Sun Sep 19 10:15:06 2021 by
1021
1096
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1022
1097
  0.9.26 (ruby-2.7.4).
1023
1098
  </div>