Class: ZabbixApi::ValueMaps
- Defined in:
- lib/zabbixapi/classes/valuemaps.rb
Instance Method Summary collapse
-
#create_or_update(data) ⇒ Integer
Create or update Item object using Zabbix API.
-
#get_or_create(data) ⇒ Integer
Get or Create ValueMap object using Zabbix API.
-
#indentify ⇒ String
The id field name used for identifying specific ValueMap objects via Zabbix API.
-
#key ⇒ String
The key field name used for ValueMap objects via Zabbix API.
-
#method_name ⇒ String
The method name used for interacting with ValueMaps via Zabbix API.
Methods inherited from Basic
#add, #all, #create, #default_options, #delete, #destroy, #dump_by_id, #get, #get_full_data, #get_id, #get_raw, #hash_equals?, #initialize, #keys, #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
#create_or_update(data) ⇒ Integer
Create or update Item object using Zabbix API
45 46 47 48 |
# File 'lib/zabbixapi/classes/valuemaps.rb', line 45 def create_or_update(data) valuemapid = get_id(name: data[:name]) valuemapid ? update(data.merge(valuemapids: [:valuemapid])) : create(data) end |
#get_or_create(data) ⇒ Integer
Get or Create ValueMap object using Zabbix API
30 31 32 33 34 35 36 37 |
# File 'lib/zabbixapi/classes/valuemaps.rb', line 30 def get_or_create(data) log "[DEBUG] Call get_or_create with parameters: #{data.inspect}" unless (id = get_id(valuemapids: data[:valuemapids])) id = create(data) end id end |
#indentify ⇒ String
The id field name used for identifying specific ValueMap objects via Zabbix API
20 21 22 |
# File 'lib/zabbixapi/classes/valuemaps.rb', line 20 def indentify 'name' end |
#key ⇒ String
The key field name used for ValueMap objects via Zabbix API
13 14 15 |
# File 'lib/zabbixapi/classes/valuemaps.rb', line 13 def key 'valuemapid' end |
#method_name ⇒ String
The method name used for interacting with ValueMaps via Zabbix API
6 7 8 |
# File 'lib/zabbixapi/classes/valuemaps.rb', line 6 def method_name 'valuemap' end |