configuration_service 1.1.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6cd9fc6de7766ed90bd9dd238497c725b395fe4b
4
- data.tar.gz: 8e3153bef43bac67e3f8b7a1e43978a42536616d
3
+ metadata.gz: ddbe076b82f49004024915c4940b8c4b659f987c
4
+ data.tar.gz: f6ef3e349a750383dc5c13239b0e1cbb3e9a7b2d
5
5
  SHA512:
6
- metadata.gz: f3e144c0799f65f1f979d66cbd80d58605a0a0a744650c3a32542e7a7273abeb44a728ea0552868fb3480c9babff8fd0a862fae6d1957d1566da9db00d52adfe
7
- data.tar.gz: 0a995102ba7f9bd104450093b4dd9f828740ff63503464d5bc74abb1cf48777897809e92c8c4ffc09278c4dcf3673758393a8af9ed9121cfbbf4e6d8c2e207c0
6
+ metadata.gz: 83dcd2e4e86d9d330e052ea60a17ce04cba84fd571476b7ae41dd5e162e918875fc5941397bcabb311a40bccecffb0525d616a087e65f6b9c75f21f7b85eec80
7
+ data.tar.gz: 0588eeb4508c67bbee33604807a444bf3f832ee1d84f94f3ff9bd1f2126f4cd0217ac6af32bbbc61976f3923128097263ca32600e2713beb7322b0d0cc50849b
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.gem
2
2
  *.rbc
3
+ /Gemfile.lock
3
4
  /.config
4
5
  /coverage/
5
6
  /InstalledFiles
data/README.rdoc CHANGED
@@ -36,11 +36,8 @@ Our +main.rb+ (or +config.ru+ or whatever) is simple:
36
36
  Bundler.require(:default)
37
37
 
38
38
  service = ConfigurationService::Factory::EnvironmentContext.create
39
- if configuraton = service.request_configuration
40
- AcmeApplication.new(configuration.data).run
41
- else
42
- raise "configuration not found"
43
- end
39
+ configuraton = service.request_configuration
40
+ AcmeApplication.new(configuration.data).run
44
41
 
45
42
  This relies on a bundler Gemfile to load the gem that contains whatever
46
43
  service provider we configure in the environment:
@@ -76,9 +73,6 @@ construct the service yourself:
76
73
  address: "http://127.0.0.1:8200"
77
74
  )
78
75
  )
79
- if configuraton = service.request_configuration
80
- AcmeApplication.new(configuration.data).run
81
- else
82
- raise "configuration not found"
83
- end
76
+ configuraton = service.request_configuration
77
+ AcmeApplication.new(configuration.data).run
84
78
 
@@ -42,10 +42,12 @@ module ConfigurationService
42
42
  # Delegates the request to the provider.
43
43
  #
44
44
  # Returns a Configuration object or raises an Error on failure.
45
- # Returns +nil+ if no matching configuration was found.
45
+ # Raises ConfigurationNotFoundError if no matching configuration
46
+ # was found.
46
47
  #
47
48
  def request_configuration
48
- @provider.request_configuration(@identifier, @token)
49
+ @provider.request_configuration(@identifier, @token) or
50
+ raise ConfigurationNotFoundError, "configuration not found for identifier: #{@identifier}"
49
51
  end
50
52
 
51
53
  ##
@@ -21,4 +21,11 @@ module ConfigurationService
21
21
  class ProviderNotFoundError < Error
22
22
  end
23
23
 
24
+ ##
25
+ #
26
+ # Configuration with the requested identifier was not found
27
+ #
28
+ class ConfigurationNotFoundError < Error
29
+ end
30
+
24
31
  end
@@ -26,11 +26,8 @@ module ConfigurationService
26
26
  # Bundler.require(:default) # Registers the vault provider
27
27
  #
28
28
  # service = ConfigurationService::Factory::EnvironmentContext.create
29
- # if configuraton = service.request_configuration
30
- # AcmeApplication.new(configuration.data).run
31
- # else
32
- # raise "configuration not found"
33
- # end
29
+ # configuraton = service.request_configuration
30
+ # AcmeApplication.new(configuration.data).run
34
31
  #
35
32
  class EnvironmentContext
36
33
 
@@ -252,6 +252,8 @@ module ConfigurationService
252
252
  def wrap_response # :nodoc:
253
253
  begin
254
254
  ConfigurationService::Test::Response::Success.new(yield)
255
+ rescue ConfigurationService::ConfigurationNotFoundError
256
+ ConfigurationService::Test::Response::Success.new(nil)
255
257
  rescue ConfigurationService::Error => e
256
258
  ConfigurationService::Test::Response::Failure.new(e)
257
259
  end
@@ -1,5 +1,5 @@
1
1
  module ConfigurationService
2
2
 
3
- VERSION = "1.1.4"
3
+ VERSION = "2.0.0"
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configuration_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sheldon Hearn
@@ -91,7 +91,6 @@ files:
91
91
  - ".gitignore"
92
92
  - ".rspec"
93
93
  - Gemfile
94
- - Gemfile.lock
95
94
  - README.md
96
95
  - README.rdoc
97
96
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,51 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- configuration_service (1.1.3)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- builder (3.2.2)
10
- cucumber (2.0.2)
11
- builder (>= 2.1.2)
12
- cucumber-core (~> 1.2.0)
13
- diff-lcs (>= 1.1.3)
14
- gherkin (~> 2.12)
15
- multi_json (>= 1.7.5, < 2.0)
16
- multi_test (>= 0.1.2)
17
- cucumber-core (1.2.0)
18
- gherkin (~> 2.12.0)
19
- diff-lcs (1.2.5)
20
- gherkin (2.12.2)
21
- multi_json (~> 1.3)
22
- multi_json (1.11.2)
23
- multi_test (0.1.2)
24
- rake (10.4.2)
25
- rspec (3.3.0)
26
- rspec-core (~> 3.3.0)
27
- rspec-expectations (~> 3.3.0)
28
- rspec-mocks (~> 3.3.0)
29
- rspec-core (3.3.2)
30
- rspec-support (~> 3.3.0)
31
- rspec-expectations (3.3.1)
32
- diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.3.0)
34
- rspec-mocks (3.3.2)
35
- diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.3.0)
37
- rspec-support (3.3.0)
38
-
39
- PLATFORMS
40
- ruby
41
-
42
- DEPENDENCIES
43
- bundler (~> 1.10)
44
- configuration_service!
45
- cucumber (~> 2.0)
46
- rake (~> 10.0)
47
- rspec (~> 3.3)
48
- rspec-expectations (~> 3.3)
49
-
50
- BUNDLED WITH
51
- 1.10.3