neuromancer-indexer 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +4 -0
- data/lib/neuromancer/indexer/client.rb +21 -3
- data/lib/neuromancer/indexer/configuration.rb +1 -1
- data/lib/neuromancer/indexer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfeb244c643ecd7751c471d2bcfa6c0c2d83f3ca
|
4
|
+
data.tar.gz: 474fe0b12cb2600926689dd5355299f60e52249f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f724edc9577bf9053691caefdc4fc27e880ca59bc30b77c8be5618b1d76ac8fa427a4045770e6f919eb7728bb0a543f6606b8b93ad3d830a5e0bdd66d215b94
|
7
|
+
data.tar.gz: d9e4476c2542d9fd38329c10a0b9a3cf36c6ab140212e818c3643d7cb0ab2339eb0ec75e2a9af7be741697849958c5d4c7228c8c8caf45b7f641e17d752089e0
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -10,6 +10,10 @@ Ruby gem to push data for indexing to the Neuromancer service
|
|
10
10
|
Neuromancer::Indexer.configure do |config|
|
11
11
|
config.region = 'eu-central-1'
|
12
12
|
config.sqs_url = 'https://sqs.eu-central-1.amazonaws.com/1234567890/neuromancer-index'
|
13
|
+
|
14
|
+
# optional
|
15
|
+
config.access_key_id = 'AWS_ACCESS_KEY_ID'
|
16
|
+
config.secret_access_key = 'AWS_SECRET_ACCESS_KEY'
|
13
17
|
end
|
14
18
|
|
15
19
|
Neuromancer::Indexer.index({
|
@@ -6,11 +6,11 @@ require 'aws-sdk-sqs'
|
|
6
6
|
module Neuromancer
|
7
7
|
module Indexer
|
8
8
|
class Client
|
9
|
-
attr_reader :config
|
9
|
+
attr_reader :config
|
10
10
|
|
11
|
-
def initialize(sqs)
|
11
|
+
def initialize(sqs = nil)
|
12
12
|
@config = Neuromancer::Indexer.config
|
13
|
-
@sqs = sqs
|
13
|
+
@sqs = sqs
|
14
14
|
end
|
15
15
|
|
16
16
|
def index(obj)
|
@@ -26,6 +26,24 @@ module Neuromancer
|
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
+
def sqs
|
30
|
+
@sqs ||= Aws::SQS::Client.new(sqs_options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def sqs_options
|
34
|
+
options = {
|
35
|
+
region: config.region
|
36
|
+
}
|
37
|
+
if config.access_key_id && config.secret_access_key
|
38
|
+
options[:credentials] = Aws::Credentials.new(
|
39
|
+
config.access_key_id,
|
40
|
+
config.secret_access_key
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
options
|
45
|
+
end
|
46
|
+
|
29
47
|
def validate_message!(message)
|
30
48
|
hash = JSON.parse(message)
|
31
49
|
id = hash['id'].to_s
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neuromancer-indexer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joergen Dahlke
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-sqs
|