Class: ZabbixApi::HttpTests
- Defined in:
- lib/zabbixapi/classes/httptests.rb
Instance Method Summary collapse
-
#create_or_update(data) ⇒ Integer
Create or update HttpTest object using Zabbix API.
-
#default_options ⇒ Hash
The default options used when creating HttpTest objects via Zabbix API.
-
#get_or_create(data) ⇒ Integer
Get or Create HttpTest object using Zabbix API.
-
#indentify ⇒ String
The id field name used for identifying specific HttpTest objects via Zabbix API.
-
#method_name ⇒ String
The method name used for interacting with HttpTests via Zabbix API.
Methods inherited from Basic
#add, #all, #create, #delete, #destroy, #dump_by_id, #get, #get_full_data, #get_id, #get_raw, #hash_equals?, #initialize, #key, #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 HttpTest object using Zabbix API
49 50 51 52 |
# File 'lib/zabbixapi/classes/httptests.rb', line 49 def create_or_update(data) httptestid = get_id(name: data[:name], hostid: data[:hostid]) httptestid ? update(data.merge(httptestid: httptestid)) : create(data) end |
#default_options ⇒ Hash
The default options used when creating HttpTest objects via Zabbix API
20 21 22 23 24 25 26 |
# File 'lib/zabbixapi/classes/httptests.rb', line 20 def { hostid: nil, name: nil, steps: [] } end |
#get_or_create(data) ⇒ Integer
Get or Create HttpTest object using Zabbix API
34 35 36 37 38 39 40 41 |
# File 'lib/zabbixapi/classes/httptests.rb', line 34 def get_or_create(data) log "[DEBUG] Call get_or_create with parameters: #{data.inspect}" unless (id = get_id(name: data[:name], hostid: data[:hostid])) id = create(data) end id end |
#indentify ⇒ String
The id field name used for identifying specific HttpTest objects via Zabbix API
13 14 15 |
# File 'lib/zabbixapi/classes/httptests.rb', line 13 def indentify 'name' end |
#method_name ⇒ String
The method name used for interacting with HttpTests via Zabbix API
6 7 8 |
# File 'lib/zabbixapi/classes/httptests.rb', line 6 def method_name 'httptest' end |