Class: SkyZabbix::Client::TargetBase Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/sky_zabbix/client/target_base.rb

Overview

This class is abstract.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, client) ⇒ TargetBase

Returns a new instance of TargetBase.

Parameters:


11
12
13
14
15
# File 'lib/sky_zabbix/client/target_base.rb', line 11

def initialize(uri, client)
  raise "Should use method of sub class!" unless _zbx_class
  @uri = uri
  @client = client
end

Class Method Details

._zbx_classString

Returns:

  • (String)

4
5
6
# File 'lib/sky_zabbix/client/target_base.rb', line 4

def self._zbx_class
  return @class
end

Instance Method Details

#get_id(filter) ⇒ Array<String>

Returns ID of founded first.

Parameters:

  • filter (Hash)

Returns:

  • (Array<String>)

    ID of founded first.


29
30
31
# File 'lib/sky_zabbix/client/target_base.rb', line 29

def get_id(filter)
  return get_ids(filter).first
end

#get_ids(filter) ⇒ Array<String>

Returns List of ID.

Parameters:

  • filter (Hash)

Returns:

  • (Array<String>)

    List of ID


19
20
21
22
23
24
25
# File 'lib/sky_zabbix/client/target_base.rb', line 19

def get_ids(filter)
  params = {
    filter: filter,
    output: 'extend',
  }
  return _query('get', params).map{|x|x[pk]}
end