elasticsearch_hermes 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2f59f38fcf425e8d7895b3b44a32ed4013d9c552
4
+ data.tar.gz: 0a42e7b1b434136d7c7c3372ffe6e3c720a15b52
5
+ SHA512:
6
+ metadata.gz: 27c21a254b77f5c5468dc91a33a696c509103cf9f2a5db00a4ddd4508d36b3b878000eeee216b6081ee9e493ef8f44f2bc462ca2834a43e04c729ffc0e6f97c9
7
+ data.tar.gz: 78746eadc2492afff69a76d007facc4e4188ed578f702ad4ae3d574424e9161dbb28701b65f3f890f996dd37836f307d838e62ad94f744cc72ffab28b84718af
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'elasticsearch'
4
+ require 'elasticsearch_hermes/configuration'
5
+ require 'elasticsearch_hermes/version'
6
+ require 'elasticsearch_hermes/index'
7
+
8
+ module ElasticsearchHermes
9
+ class << self
10
+ attr_writer :configuration
11
+ end
12
+
13
+ def self.configuration
14
+ @configuration ||= Configuration.new
15
+ end
16
+
17
+ def self.reset
18
+ @configuration = Configuration.new
19
+ end
20
+
21
+ def self.configure
22
+ yield(configuration)
23
+ end
24
+
25
+ def self.default_connect_options
26
+ base_es_urls = configuration.elasticsearch_url
27
+ urls = base_es_urls.split(',').compact.uniq
28
+ options = { url: urls, retry_on_failure: 2, log: true }
29
+ options
30
+ end
31
+
32
+ def self.client
33
+ @client ||= ::Elasticsearch::Client.new(default_connect_options)
34
+ end
35
+
36
+ def self.refresh
37
+ client.indices.refresh
38
+ end
39
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ElasticsearchHermes
4
+ class Configuration
5
+ attr_accessor :request_timeout, :retry_on_failure, :elasticsearch_user, :elasticsearch_password, :elasticsearch_url, :is_protected
6
+
7
+ def initialize
8
+ @request_timeout = nil
9
+ @retry_on_failure = nil
10
+ @elasticsearch_user = nil
11
+ @elasticsearch_password = nil
12
+ @elasticsearch_url = nil
13
+ @is_protected = nil
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ElasticsearchHermes
4
+ class Index
5
+ attr_reader :name
6
+
7
+ def initialize(name)
8
+ @name = name
9
+ end
10
+
11
+ def create
12
+ client.indices.create index: name, body: {}
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ElasticsearchHermes
4
+ VERSION = '0.0.4'
5
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: elasticsearch_hermes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Ronald Ekambi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-12-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: ronekambi@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/elasticsearch_hermes.rb
20
+ - lib/elasticsearch_hermes/configuration.rb
21
+ - lib/elasticsearch_hermes/index.rb
22
+ - lib/elasticsearch_hermes/version.rb
23
+ homepage: https://github.com/roncodingenthusiast/elasticsearch_hermes
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.6.14.3
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: elasticsearch_hermes is a layer on top of elasticsearch to handle searching
47
+ test_files: []