Class: FlyingSphinx::Configuration
- Inherits:
-
Object
- Object
- FlyingSphinx::Configuration
- Defined in:
- lib/flying_sphinx/configuration.rb
Instance Attribute Summary collapse
-
#database_port ⇒ Object
readonly
Returns the value of attribute database_port.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#ssh_server ⇒ Object
readonly
Returns the value of attribute ssh_server.
Instance Method Summary collapse
- #api ⇒ Object
- #client_key ⇒ Object
-
#initialize(identifier = nil, api_key = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #output_recent_actions ⇒ Object
- #start_sphinx ⇒ Object
- #stop_sphinx ⇒ Object
Constructor Details
#initialize(identifier = nil, api_key = nil) ⇒ Configuration
Returns a new instance of Configuration.
4 5 6 7 8 9 |
# File 'lib/flying_sphinx/configuration.rb', line 4 def initialize(identifier = nil, api_key = nil) @identifier = identifier || identifier_from_env @api_key = api_key || api_key_from_env set_from_server end |
Instance Attribute Details
#database_port ⇒ Object (readonly)
Returns the value of attribute database_port.
2 3 4 |
# File 'lib/flying_sphinx/configuration.rb', line 2 def database_port @database_port end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
2 3 4 |
# File 'lib/flying_sphinx/configuration.rb', line 2 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
2 3 4 |
# File 'lib/flying_sphinx/configuration.rb', line 2 def port @port end |
#ssh_server ⇒ Object (readonly)
Returns the value of attribute ssh_server.
2 3 4 |
# File 'lib/flying_sphinx/configuration.rb', line 2 def ssh_server @ssh_server end |
Instance Method Details
#api ⇒ Object
11 12 13 |
# File 'lib/flying_sphinx/configuration.rb', line 11 def api @api ||= FlyingSphinx::API.new(identifier, api_key) end |
#client_key ⇒ Object
23 24 25 |
# File 'lib/flying_sphinx/configuration.rb', line 23 def client_key "#{identifier}:#{api_key}" end |
#output_recent_actions ⇒ Object
27 28 29 30 31 |
# File 'lib/flying_sphinx/configuration.rb', line 27 def output_recent_actions api.get('actions').body.each do |action| puts "#{action.created_at} #{action.name}" end end |
#start_sphinx ⇒ Object
15 16 17 |
# File 'lib/flying_sphinx/configuration.rb', line 15 def start_sphinx api.post('start').success? end |
#stop_sphinx ⇒ Object
19 20 21 |
# File 'lib/flying_sphinx/configuration.rb', line 19 def stop_sphinx api.post('stop').success? end |