Module: Splunker::Connection
- Defined in:
- lib/splunker/connection.rb
Instance Method Summary collapse
-
#connection ⇒ Object
Returns an existing, or new, Faraday instance.
- #reset ⇒ Object
Instance Method Details
#connection ⇒ Object
Returns an existing, or new, Faraday instance. If a new connection is desired, #reset must be called.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/splunker/connection.rb', line 12 def connection if self.configuration[:endpoint].nil? raise ConfigurationError, "No endpoint set!" end opts = { :url => self.configuration[:endpoint] } opts[:ssl] = {:verify => false} if !self.configuration[:ssl_verify] @connection ||= Faraday.new(opts) do |c| c.use Faraday::Request::UrlEncoded c.use Faraday::Response::Logger c.use Faraday::Adapter::NetHttp c.use Splunker::FaradayMiddleware end end |
#reset ⇒ Object
6 7 8 |
# File 'lib/splunker/connection.rb', line 6 def reset @connection = nil end |