simple_parameter_store 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: 4f8bc88322fc430919cc4eb79628ce142cd0e2194a0ac7c77cc7ce02acc3ce44
4
- data.tar.gz: 1bbf1b7f83ef3fc9e2b8d8b717be07f195b142f64a6bd6960c10576bddf46cfc
3
+ metadata.gz: bcfb91829da93dc3fba46791a808a891ceed8e8806331ae6eee052b80987a394
4
+ data.tar.gz: 82e5b470b4806c02e6b745446cf95734424abd5c7aba86b4407519c66c2ed5ef
5
5
  SHA512:
6
- metadata.gz: 3bb50891a011946d2d48ab795e48419b1a6f117f3f428bd1801058fb7cf6e3efda63189d47b11bc17a97736bde53533b59895a22602d816a187f9d1d96f644e4
7
- data.tar.gz: 6c12a7522f797fb8b5d869e9dacfbb8964336638a2844d7cff2063a72238fd4770be3ef65189ff083c89b0a1ba783ea93931b36a7049a9b83b6962e911fde371
6
+ metadata.gz: 5c380e14e2155aa87480c32c8e32a86d62aa55649cfc1061e8d7843359ed25ccc544c70c9cc779363e26d791eb404376048ba33159f77a4762d16644ff0f7070
7
+ data.tar.gz: 6700dc6cb2e488fe5636663d9bdb0eff3a79205f03fbfe897bb8fe4ec01df5e476dd26f83d8cccacef780d6f8453a3f06817459905b9abde6506cc0bd5bfa76b
data/Gemfile CHANGED
@@ -7,6 +7,6 @@ gemspec
7
7
 
8
8
  gem 'mutant', github: 'mbj/mutant'
9
9
 
10
- source 'https://6MzqeHoxySwKpgklFubwKEE80auW03cr@gem.mutant.dev' do
10
+ source 'https://oss:6MzqeHoxySwKpgklFubwKEE80auW03cr@gem.mutant.dev' do
11
11
  gem 'mutant-license'
12
12
  end
@@ -23,12 +23,12 @@ GIT
23
23
  PATH
24
24
  remote: .
25
25
  specs:
26
- simple_parameter_store (0.2.0)
26
+ simple_parameter_store (0.2.1)
27
27
  aws-sdk-ssm
28
28
 
29
29
  GEM
30
30
  remote: https://rubygems.org/
31
- remote: https://6MzqeHoxySwKpgklFubwKEE80auW03cr@gem.mutant.dev/
31
+ remote: https://oss:6MzqeHoxySwKpgklFubwKEE80auW03cr@gem.mutant.dev/
32
32
  specs:
33
33
  abstract_type (0.0.7)
34
34
  adamantium (0.2.0)
@@ -24,10 +24,10 @@ class SimpleParameterStore
24
24
  attr_reader :client, :prefix, :decrypt, :expires_after, :expires_at
25
25
 
26
26
  def refresh
27
- fetch.each do |parameter|
28
- key, = @mappings.rassoc(parameter.name)
27
+ fetch.each_pair do |name, value|
28
+ key, = @mappings.rassoc(name)
29
29
  caster = @casters.fetch(key)
30
- value = caster.call(parameter.value)
30
+ value = caster.call(value)
31
31
  @cache[key] = value
32
32
  end
33
33
 
@@ -53,7 +53,7 @@ class SimpleParameterStore
53
53
  result = client.get_parameters(names: @mappings.values, with_decryption: decrypt)
54
54
  raise SSMKeyError, "Missing keys: `#{result.invalid_parameters}`" if result.invalid_parameters.any?
55
55
 
56
- result.parameters
56
+ result.parameters.map { |parameter| [parameter.name, parameter.value] }.to_h
57
57
  end
58
58
 
59
59
  def prepare(names)
@@ -4,14 +4,6 @@ class SimpleParameterStore
4
4
  module Mock
5
5
  class MockError < StandardError; end
6
6
 
7
- class Parameter
8
- attr_reader :name, :value
9
- def initialize(name, value)
10
- @name = name
11
- @value = value
12
- end
13
- end
14
-
15
7
  def self.prepended(base)
16
8
  base.extend ClassMethods
17
9
  end
@@ -22,7 +14,7 @@ class SimpleParameterStore
22
14
  %i[prefix decrypt expires_after client].each do |key|
23
15
  current_value = instance_variable_get("@#{key}")
24
16
  expected_value = self.class.mock.fetch(key)
25
- raise MockError, <<~ERROR unless current_value.equal?(expected_value)
17
+ raise MockError, <<~ERROR unless current_value.eql?(expected_value)
26
18
  Invalid `:#{key}`:
27
19
  expected: `#{expected_value}`
28
20
  current: `#{current_value}`
@@ -45,7 +37,7 @@ class SimpleParameterStore
45
37
 
46
38
  def mock=(names:, client: nil, prefix: nil, decrypt: true, expires_after: nil)
47
39
  @mock = {
48
- cache: names.map { |(key, value)| Parameter.new("#{prefix}#{key}", value) },
40
+ cache: names.transform_keys { |key| "#{prefix}#{key}" },
49
41
  prefix: prefix,
50
42
  decrypt: decrypt,
51
43
  expires_after: expires_after,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SimpleParameterStore
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_parameter_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timo Schilling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-07 00:00:00.000000000 Z
11
+ date: 2019-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-ssm