Method: Zabbix.client

Defined in:
lib/zabbix.rb

.client(options = {}) ⇒ Zabbix::Client

Creates and returns a new Zabbix client instance. Merges default client settings with any user-provided options.

Examples:

Create a client with a custom User-Agent and endpoint:

client = Zabbix.client(user_agent: "MyApp Zabbix Client", endpoint: "https://zabbix.example.com/api_jsonrpc.php")


33
34
35
36
37
38
39
# File 'lib/zabbix.rb', line 33

def self.client(options = {})
  # Ensure that the options argument is a Hash to prevent merge errors

  options = options.is_a?(Hash) ? options : {}
  Zabbix::Client.new({
    user_agent: DEFAULT_UA
  }.merge(options))
end