Class: ZabbixApi::Users
Instance Method Summary collapse
-
#add_medias(data) ⇒ Integer
Add media to users using Zabbix API.
-
#indentify ⇒ String
The id field name used for identifying specific User objects via Zabbix API.
-
#key ⇒ String
The key field name used for User objects via Zabbix API.
-
#keys ⇒ String
The keys field name used for User objects via Zabbix API.
- #medias_helper(data, action) ⇒ Object
-
#method_name ⇒ String
The method name used for interacting with Users via Zabbix API.
-
#update_medias(data) ⇒ Integer
Update media for users using Zabbix API.
Methods inherited from Basic
#add, #all, #create, #create_or_update, #default_options, #delete, #destroy, #dump_by_id, #get, #get_full_data, #get_id, #get_or_create, #get_raw, #hash_equals?, #initialize, #log, #merge_params, #normalize_array, #normalize_hash, #parse_keys, #symbolize_keys, #update
Constructor Details
This class inherits a constructor from ZabbixApi::Basic
Instance Method Details
#add_medias(data) ⇒ Integer
Add media to users using Zabbix API
50 51 52 |
# File 'lib/zabbixapi/classes/users.rb', line 50 def add_medias(data) medias_helper(data, 'update') end |
#indentify ⇒ String
The id field name used for identifying specific User objects via Zabbix API
27 28 29 |
# File 'lib/zabbixapi/classes/users.rb', line 27 def indentify 'alias' end |
#key ⇒ String
The key field name used for User objects via Zabbix API
20 21 22 |
# File 'lib/zabbixapi/classes/users.rb', line 20 def key 'userid' end |
#keys ⇒ String
The keys field name used for User objects via Zabbix API
13 14 15 |
# File 'lib/zabbixapi/classes/users.rb', line 13 def keys 'userids' end |
#medias_helper(data, action) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/zabbixapi/classes/users.rb', line 31 def medias_helper(data, action) result = @client.api_request( method: "user.#{action}", params: data[:userids].map do |t| { userid: t, user_medias: data[:media], } end, ) result ? result['userids'][0].to_i : nil end |
#method_name ⇒ String
The method name used for interacting with Users via Zabbix API
6 7 8 |
# File 'lib/zabbixapi/classes/users.rb', line 6 def method_name 'user' end |
#update_medias(data) ⇒ Integer
Update media for users using Zabbix API
60 61 62 |
# File 'lib/zabbixapi/classes/users.rb', line 60 def update_medias(data) medias_helper(data, 'update') end |