wcc-data 0.3.2 → 0.3.3

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: 02d7a1ec54bdcac827469f19b3070bd28caa171b
4
- data.tar.gz: 87047ce1841ca72d6e3f63010ce906d1c068a268
3
+ metadata.gz: 9230bc1ee02de1bf143a3f9d758738a5e204b735
4
+ data.tar.gz: 725661d38a8aa43e6828646a57f5b75d8f34b7aa
5
5
  SHA512:
6
- metadata.gz: 5dbc59326f6d74240b8f73edbc6119c549460c4350fcb21df324794ee513be5f1ad70ea9a6ef94961bfc982130cb2203d9b11440f401aebd0e589a9fffd7445a
7
- data.tar.gz: 182635eddf51ab2b626d926ffb4e4177f8ce47c40f17f19594eae2741841dd9333b97d3bccb58b28371a8e68d5d18928ec583df203194af74cfc6d4860ba777a
6
+ metadata.gz: c79626edcd8f549520c59ae019a4218cbb50394a5b351d066ba0abefaa8f735694d9ecfbcebfcf393b7fb8b71aff8533d79d36ffbd195f8f5340541586653ccb
7
+ data.tar.gz: 7cb4da447fb750e8de2f0343800983ae20c0e2f8394940eda1f5aa027c1fa4bc5c930929dd19fc6ac65e84733df8b4b2acecf05f134f5017d2fb2c5e3d90c6be
@@ -15,6 +15,7 @@ module WCC::Data
15
15
  private
16
16
 
17
17
  def set_default_applications
18
+ raise ArgumentError, "Missing NUCLEUS_URL environment variable" unless ENV['NUCLEUS_URL']
18
19
  applications[:nucleus].uri = ENV['NUCLEUS_URL']
19
20
  if ENV['APP_CLIENT_ID'] && ENV['APP_CLIENT_SECRET']
20
21
  applications[:nucleus].connection
@@ -5,6 +5,7 @@ module WCC::Data
5
5
  class EndpointUndefined < MapperError; end
6
6
  class InvalidResponse < MapperError; end
7
7
  class RecordNotFound < MapperError; end
8
+ class ServiceUnavailable < MapperError; end
8
9
  end
9
10
 
10
11
  end
@@ -4,6 +4,7 @@ module WCC::Data::Mapper
4
4
 
5
5
  def new_from_response(response)
6
6
  raise RecordNotFound if response.status == 404
7
+ raise ServiceUnavailable if response.status == 503
7
8
  case response.json
8
9
  when Array
9
10
  response.json.collect { |obj| new(obj) }
@@ -1,5 +1,5 @@
1
1
  module WCC
2
2
  module Data
3
- VERSION = '0.3.2'.freeze
3
+ VERSION = '0.3.3'.freeze
4
4
  end
5
5
  end
@@ -19,4 +19,6 @@ RSpec.configure do |config|
19
19
  config.filter_run :focus
20
20
 
21
21
  config.order = 'random'
22
+
23
+ ENV['NUCLEUS_URL'] ||= 'http://login.wcc'
22
24
  end
@@ -219,6 +219,19 @@ RSpec.describe WCC::Data::FaradayClientAppTokenAuth do
219
219
  expect(cache).to receive(:[]=).with("example.com", "abc123")
220
220
  auth.token_for("example.com")
221
221
  end
222
+
223
+ it "passes error up the chain when service unavailable" do
224
+ allow(auth.token_factory)
225
+ .to receive(:call)
226
+ .and_raise(WCC::Data::Mapper::ServiceUnavailable)
227
+
228
+ expect {
229
+ auth.call({
230
+ url: URI("http://example.com"),
231
+ request_headers: {},
232
+ })
233
+ }.to raise_error(WCC::Data::Mapper::ServiceUnavailable)
234
+ end
222
235
  end
223
236
  end
224
237
  end
@@ -41,6 +41,13 @@ describe WCC::Data::Mapper::JSONResponse do
41
41
 
42
42
  end
43
43
 
44
+ it "raises ServiceUnavailable when response status is 503" do
45
+ allow(singular_response).to receive(:status).and_return(503)
46
+ expect { klass.new_from_response(singular_response) }
47
+ .to raise_error(WCC::Data::Mapper::ServiceUnavailable)
48
+
49
+ end
50
+
44
51
  it "raises InvalidResponse error for non-json objects" do
45
52
  expect { klass.new_from_response(double(json: 1, status: 200)) }
46
53
  .to raise_error(WCC::Data::Mapper::InvalidResponse)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wcc-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Watermark Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-23 00:00:00.000000000 Z
11
+ date: 2019-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  requirements: []
175
175
  rubyforge_project:
176
- rubygems_version: 2.6.11
176
+ rubygems_version: 2.5.2
177
177
  signing_key:
178
178
  specification_version: 4
179
179
  summary: Watermark's library for interapp communication via APIs