Class: Splunker::Client
- Inherits:
-
Object
- Object
- Splunker::Client
- Includes:
- Configuration
- Defined in:
- lib/splunker/client.rb
Overview
The Splunk API client. Methods include get, post, put, and delete HTTP helpers:
c.get("...")
See Splunker::Request for more details.
Constant Summary
Constants included from Configuration
Splunker::Configuration::DEFAULT_APP_NAME, Splunker::Configuration::DEFAULT_ENDPOINT, Splunker::Configuration::DEFAULT_SSL_VERIFY, Splunker::Configuration::MUTABLE_IMPLEMENTED_OPTION_KEYS, Splunker::Configuration::MUTABLE_OPTION_KEYS, Splunker::Configuration::READONLY_OPTION_KEYS
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
Creates a new Splunker client instance.
- #method_missing(method, *args, &block) ⇒ Object
- #respond_to?(method) ⇒ Boolean
Methods included from Configuration
#auth_mode=, #configuration, #configure, included, #reset
Constructor Details
#initialize(options = {}) ⇒ Client
Creates a new Splunker client instance. Options are:
-
:username => Required. The username to make requests on behalf of
-
:password => Required. The password to authenticate with
-
:auth_mode => Required. The authentication method to use. :http_auth or :token_auth.
-
:endpoint => (“localhost:8089”) The host of the Splunk API
-
:ssl_verify => (true) If false, the SSL cert fro the Splunk server will not be verified.
-
:app => (“search”)
20 21 22 23 24 25 26 |
# File 'lib/splunker/client.rb', line 20 def initialize(={}) self.reset (Configuration::MUTABLE_IMPLEMENTED_OPTION_KEYS + Configuration::MUTABLE_OPTION_KEYS).each do |key| self.send "#{key}=", [key] if .include?(key) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/splunker/client.rb', line 28 def method_missing(method,*args,&block) if self.request_handler.respond_to?(method) return self.request_handler.send(method,*args,&block) end super end |
Instance Method Details
#respond_to?(method) ⇒ Boolean
35 36 37 |
# File 'lib/splunker/client.rb', line 35 def respond_to?(method) self.request_handler.respond_to?(method) || super end |