Class: Realm::Elasticsearch::Gateway
- Inherits:
-
Object
- Object
- Realm::Elasticsearch::Gateway
show all
- Defined in:
- lib/realm/elasticsearch/gateway.rb
Instance Method Summary
collapse
Constructor Details
#initialize(url:, **options) ⇒ Gateway
Returns a new instance of Gateway.
6
7
8
9
|
# File 'lib/realm/elasticsearch/gateway.rb', line 6
def initialize(url:, **options)
@url = url
@client_options = options.slice(:adapter, :retry_on_failure, :request_timeout)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing ⇒ Object
22
23
24
|
# File 'lib/realm/elasticsearch/gateway.rb', line 22
def method_missing(...)
client.send(...)
end
|
Instance Method Details
#health ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/realm/elasticsearch/gateway.rb', line 11
def health
issues = []
index_names = Repository.subclasses.map(&:index_name)
begin
issues << 'One or more indexes missing' unless client.indices.exists(index: index_names)
rescue StandardError => e
issues << "Elasticsearch connection error: #{e.full_message}"
end
HealthStatus.from_issues(issues)
end
|
#respond_to_missing? ⇒ Boolean
26
27
28
|
# File 'lib/realm/elasticsearch/gateway.rb', line 26
def respond_to_missing?(...)
client.respond_to?(...)
end
|