Module: Zabby::ZClass::ClassMethods
- Defined in:
- lib/zabby/zclass.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
The id field name for the model (“actionid”, “hostid”, etc.).
-
#zmethods ⇒ Object
readonly
List of valid Web Service methods for the current Zabbix Object.
Instance Method Summary collapse
-
#class_name ⇒ String
Name of the current class without the namespace.
-
#inspect ⇒ String
Human representation of the Zabbix Class.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(zmethod, *args, &block) ⇒ Object (private)
Simulate methods on the object and call the Zabbix Web Service (“host.get”, “item.create”, etc.). See www.zabbix.com/documentation/1.8/api for the API documentation.
71 72 73 74 75 76 77 |
# File 'lib/zabby/zclass.rb', line 71 def method_missing(zmethod, *args, &block) if @zmethods.include? zmethod Zabby::Runner.instance.connection.perform_request(class_name, zmethod, args.first) else super end end |
Instance Attribute Details
#id ⇒ Object (readonly)
The id field name for the model (“actionid”, “hostid”, etc.)
28 29 30 |
# File 'lib/zabby/zclass.rb', line 28 def id @id end |
#zmethods ⇒ Object (readonly)
List of valid Web Service methods for the current Zabbix Object
26 27 28 |
# File 'lib/zabby/zclass.rb', line 26 def zmethods @zmethods end |
Instance Method Details
#class_name ⇒ String
Name of the current class without the namespace
34 35 36 |
# File 'lib/zabby/zclass.rb', line 34 def class_name @class_name ||= self.name.split(/::/).last.downcase end |
#inspect ⇒ String
Human representation of the Zabbix Class
42 43 44 |
# File 'lib/zabby/zclass.rb', line 42 def inspect "<#{name} methods=(#{@zmethods.join(', ')})>" end |