neuromancer-indexer 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-gems.yml +11 -0
- data/CHANGELOG.md +3 -0
- data/README.md +23 -7
- data/gems.locked +2 -2
- data/lib/neuromancer/indexer/client.rb +3 -3
- data/lib/neuromancer/indexer/document.rb +4 -4
- data/lib/neuromancer/indexer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 923187d8ea912f966d2bfc1c323fdb736706867359b7adc17466a220ee7e50fc
|
4
|
+
data.tar.gz: 3b8f4cf05967b285d7ed583c06abcb1d596fa3e0cb2e384441c04756f896cd3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaabed6b75d852e09f27b0e032291adb90727585b22a698f1af8a3512e6aa6c34720a9684b5c2f64bd57e45be461e0c44e1069057dd38190a0f7362b34829957
|
7
|
+
data.tar.gz: afd1756604eb10e42d1a8004217a150477dc85d93b9793911868293dfc483ab4e5312de4484d7e5544eda282b66e28b2d726e3de17e30375d670c1f8f4f6be5c
|
@@ -22,6 +22,17 @@ jobs:
|
|
22
22
|
gem install bundler
|
23
23
|
bundle install
|
24
24
|
|
25
|
+
- name: Push to GitHub Package Repository
|
26
|
+
run: |
|
27
|
+
mkdir -p $HOME/.gem
|
28
|
+
touch $HOME/.gem/credentials
|
29
|
+
chmod 0600 $HOME/.gem/credentials
|
30
|
+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
31
|
+
gem build *.gemspec
|
32
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
33
|
+
env:
|
34
|
+
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
|
35
|
+
OWNER: ${{ github.repository_owner }}
|
25
36
|
|
26
37
|
- name: Push to RubyGems
|
27
38
|
run: |
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,9 +2,12 @@
|
|
2
2
|
|
3
3
|
[![GitHub Actions Test Status](https://github.com/jdahlke/neuromancer-indexer/workflows/Tests/badge.svg?branch=develop)](https://github.com/jdahlke/neuromancer-indexer/actions)
|
4
4
|
|
5
|
-
Ruby gem to push data for indexing to the Neuromancer service
|
5
|
+
Ruby gem to push data for indexing to the Neuromancer service.
|
6
6
|
|
7
|
-
|
7
|
+
|
8
|
+
### Getting started
|
9
|
+
|
10
|
+
Configuration
|
8
11
|
|
9
12
|
```
|
10
13
|
Neuromancer::Indexer.configure do |config|
|
@@ -15,19 +18,32 @@ Neuromancer::Indexer.configure do |config|
|
|
15
18
|
config.access_key_id = 'AWS_ACCESS_KEY_ID'
|
16
19
|
config.secret_access_key = 'AWS_SECRET_ACCESS_KEY'
|
17
20
|
end
|
21
|
+
```
|
18
22
|
|
19
|
-
|
23
|
+
Indexing objects
|
24
|
+
|
25
|
+
```
|
26
|
+
Neuromancer::Indexer.index(
|
20
27
|
id: 'id-1',
|
21
28
|
type: 'objects',
|
22
|
-
|
29
|
+
attributes: {
|
23
30
|
foo: 'foo-string',
|
24
31
|
bar: 123,
|
25
32
|
baz: ['abc', 'def']
|
26
33
|
}
|
27
|
-
|
34
|
+
)
|
35
|
+
```
|
36
|
+
|
37
|
+
Deleting objects
|
38
|
+
|
39
|
+
```
|
40
|
+
Neuromancer::Indexer.delete(
|
41
|
+
id: 'id-1',
|
42
|
+
type: 'objects'
|
43
|
+
)
|
28
44
|
```
|
29
45
|
|
30
|
-
Stubbing in
|
46
|
+
Stubbing in Specs
|
31
47
|
|
32
48
|
```
|
33
49
|
RSpec.configure do |config|
|
@@ -49,5 +65,5 @@ gem 'neuromancer-indexer'
|
|
49
65
|
### Test
|
50
66
|
|
51
67
|
```
|
52
|
-
bundle exec
|
68
|
+
bundle exec rspec spec
|
53
69
|
```
|
data/gems.locked
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
neuromancer-indexer (0.4.
|
4
|
+
neuromancer-indexer (0.4.4)
|
5
5
|
aws-sdk-sqs
|
6
6
|
|
7
7
|
GEM
|
@@ -9,7 +9,7 @@ GEM
|
|
9
9
|
specs:
|
10
10
|
ast (2.4.1)
|
11
11
|
aws-eventstream (1.1.0)
|
12
|
-
aws-partitions (1.
|
12
|
+
aws-partitions (1.354.0)
|
13
13
|
aws-sdk-core (3.104.3)
|
14
14
|
aws-eventstream (~> 1, >= 1.0.2)
|
15
15
|
aws-partitions (~> 1, >= 1.239.0)
|
@@ -10,15 +10,15 @@ module Neuromancer
|
|
10
10
|
@sqs = sqs
|
11
11
|
end
|
12
12
|
|
13
|
-
def index(id:, type:,
|
14
|
-
document = Document.new(id: id, type: type,
|
13
|
+
def index(id:, type:, attributes:)
|
14
|
+
document = Document.new(id: id, type: type, attributes: attributes)
|
15
15
|
document.validate!
|
16
16
|
|
17
17
|
enqueue(action: 'index', document: document)
|
18
18
|
end
|
19
19
|
|
20
20
|
def delete(id:, type:)
|
21
|
-
document = Document.new(id: id, type: type,
|
21
|
+
document = Document.new(id: id, type: type, attributes: {})
|
22
22
|
document.validate!
|
23
23
|
|
24
24
|
enqueue(action: 'delete', document: document)
|
@@ -3,19 +3,19 @@
|
|
3
3
|
module Neuromancer
|
4
4
|
module Indexer
|
5
5
|
class Document
|
6
|
-
attr_reader :id, :type, :
|
6
|
+
attr_reader :id, :type, :attributes
|
7
7
|
|
8
8
|
def initialize(attributes)
|
9
9
|
@id = indifferent_value(attributes, :id).to_s
|
10
10
|
@type = indifferent_value(attributes, :type).to_s
|
11
|
-
@
|
11
|
+
@attributes = indifferent_value(attributes, :attributes)
|
12
12
|
end
|
13
13
|
|
14
14
|
def as_json
|
15
15
|
{
|
16
16
|
id: id,
|
17
17
|
type: type,
|
18
|
-
|
18
|
+
attributes: attributes
|
19
19
|
}
|
20
20
|
end
|
21
21
|
|
@@ -24,7 +24,7 @@ module Neuromancer
|
|
24
24
|
|
25
25
|
errors << 'document#id is empty' if id.empty?
|
26
26
|
errors << 'document#type is empty' if type.empty?
|
27
|
-
errors << 'document#
|
27
|
+
errors << 'document#attributes is not a Hash' unless attributes.is_a?(Hash)
|
28
28
|
|
29
29
|
raise(InvalidDocument, errors) unless errors.empty?
|
30
30
|
end
|
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.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joergen Dahlke
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-sqs
|