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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bf1df12d4386c3ef0da0ef28114803dbe0623d1
4
- data.tar.gz: 8af4ec37e2cf7b14796926d3e403b48b20866027
3
+ metadata.gz: bfeb244c643ecd7751c471d2bcfa6c0c2d83f3ca
4
+ data.tar.gz: 474fe0b12cb2600926689dd5355299f60e52249f
5
5
  SHA512:
6
- metadata.gz: 027b8f9c4a3fc6bab3c0487f223952d41aace4a8693ca226cd8563fdc0736311f538c36f3a80264a5009d74e231b75fc84b2fdec894632aad498123fb275d3c9
7
- data.tar.gz: b01cfdc29a4451a771b2d3a2d3c18c1d02802dd3fada8298c7be542f5b0cd4d3200e58f6c0440aa3e685dbce342c8e3276975a8c3eeb5e8c942ea2d5ccef49c4
6
+ metadata.gz: 4f724edc9577bf9053691caefdc4fc27e880ca59bc30b77c8be5618b1d76ac8fa427a4045770e6f919eb7728bb0a543f6606b8b93ad3d830a5e0bdd66d215b94
7
+ data.tar.gz: d9e4476c2542d9fd38329c10a0b9a3cf36c6ab140212e818c3643d7cb0ab2339eb0ec75e2a9af7be741697849958c5d4c7228c8c8caf45b7f641e17d752089e0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## Changelog
2
2
 
3
+ #### 0.3.0
4
+ - optionally use AWS user credentials for SQS instead of role credentials
5
+
3
6
  #### 0.2.0
4
7
  - add `NeuromancerSpec.stub` to support unit tests
5
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neuromancer-indexer (0.2.0)
4
+ neuromancer-indexer (0.3.0)
5
5
  aws-sdk-sqs
6
6
 
7
7
  GEM
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, :sqs
9
+ attr_reader :config
10
10
 
11
- def initialize(sqs)
11
+ def initialize(sqs = nil)
12
12
  @config = Neuromancer::Indexer.config
13
- @sqs = sqs || Aws::SQS::Client.new(region: config.region)
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
@@ -7,7 +7,7 @@ module Neuromancer
7
7
  class Configuration
8
8
  attr_accessor :region
9
9
  attr_accessor :sqs_url
10
- attr_accessor :stage
10
+ attr_accessor :access_key_id, :secret_access_key
11
11
 
12
12
  def initialize
13
13
  @region = 'eu-central-1'
@@ -1,5 +1,5 @@
1
1
  module Neuromancer
2
2
  module Indexer
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  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.2.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-21 00:00:00.000000000 Z
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