Class: FlyingSphinx::Configuration
- Inherits:
-
Object
- Object
- FlyingSphinx::Configuration
- Defined in:
- lib/flying_sphinx/configuration.rb
Instance Method Summary collapse
- #api ⇒ Object
- #client_key ⇒ Object
- #host ⇒ Object
-
#initialize(identifier = nil, api_key = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #port ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(identifier = nil, api_key = nil) ⇒ Configuration
Returns a new instance of Configuration.
2 3 4 5 |
# File 'lib/flying_sphinx/configuration.rb', line 2 def initialize(identifier = nil, api_key = nil) @identifier = identifier || identifier_from_env @api_key = api_key || api_key_from_env end |
Instance Method Details
#api ⇒ Object
7 8 9 |
# File 'lib/flying_sphinx/configuration.rb', line 7 def api @api ||= FlyingSphinx::API.new(identifier, api_key) end |
#client_key ⇒ Object
11 12 13 |
# File 'lib/flying_sphinx/configuration.rb', line 11 def client_key "#{identifier}:#{api_key}" end |
#host ⇒ Object
15 16 17 |
# File 'lib/flying_sphinx/configuration.rb', line 15 def host @host ||= response_body['server'] rescue host_from_env end |
#port ⇒ Object
19 20 21 |
# File 'lib/flying_sphinx/configuration.rb', line 19 def port @port ||= response_body['port'] rescue port_from_env end |
#username ⇒ Object
23 24 25 |
# File 'lib/flying_sphinx/configuration.rb', line 23 def username "#{identifier}#{api_key}" end |