zbx 1.1.1 → 1.1.2

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.
Files changed (4) hide show
  1. data/README.md +32 -4
  2. data/lib/zbx.rb +1 -1
  3. data/lib/zbx/version.rb +1 -1
  4. metadata +1 -1
data/README.md CHANGED
@@ -26,23 +26,49 @@ require 'zbx'
26
26
 
27
27
  # the following code are doing the same thing ,that is get a host whose id is 10160
28
28
 
29
- ZBX::API.new username, password, api_url do
29
+ ZBX.client user, password, api_url do
30
30
  host.get hostids: 10160
31
31
  end
32
32
 
33
- ZBX::API.new username, password, api_url do
33
+ ZBX.client user, password, api_url do
34
34
  host do
35
35
  get hostids: 10160
36
36
  end
37
37
  end
38
38
 
39
- ZBX::API.new(username, password, api_url).host.get hostids: 10160
40
39
 
41
- ZBX::API.new do
40
+
41
+ ZBX.client do
42
42
  set username: 'username', password: password
43
43
  set api_url: 'http://api_url'
44
44
  host.get hostids: 10160
45
45
  end
46
+
47
+ client = ZBX.client(username, password, api_url)
48
+ client.host.get hostids: 10160
49
+
50
+ host_api = client.host
51
+ host_api.get hostids: 10160
52
+ ```
53
+
54
+ ```bash
55
+ # CLI
56
+
57
+ # get the name of a host whose id is 10160
58
+ > $ zbx send host.get '{"hostids": 10160, "output": ["name"]}'
59
+ # output:
60
+ # [{"hostid"=>"10160", "name"=>"store03.pf"}]
61
+
62
+ # open api doc in browser
63
+ > $ zbx doc host.get -v 2.0
64
+
65
+ # help
66
+ > $ zbx help
67
+ # output:
68
+ # Commands:
69
+ # zbx doc [method-name or entity-name] # Open the api doc in browser, -d its short term
70
+ # zbx help [COMMAND] # Describe available commands or one specific command
71
+ # zbx send [method] [data] # Send api request to zabbix server, -s is its short term
46
72
  ```
47
73
 
48
74
  ## Contributing
@@ -52,3 +78,5 @@ end
52
78
  3. Commit your changes (`git commit -am 'Add some feature'`)
53
79
  4. Push to the branch (`git push origin my-new-feature`)
54
80
  5. Create new Pull Request
81
+
82
+
data/lib/zbx.rb CHANGED
@@ -7,7 +7,7 @@ require 'json'
7
7
  require 'net/http'
8
8
 
9
9
  module ZBX
10
- def self.client user, password, api_url, &block
10
+ def self.client user=nil, password=nil, api_url=nil, &block
11
11
  API.new user, password, api_url, &block
12
12
  end
13
13
  end
data/lib/zbx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ZBX
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zbx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: