wes-data-api 6.1.0 → 6.2.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: a7b2c375755c75bb6d7e4cc6d38a36168ec56e4e
4
- data.tar.gz: 5c78d00870f69c904610e477b824d13136687de3
3
+ metadata.gz: 502ea4512a30200c3d773d34ca3c7db769b61e48
4
+ data.tar.gz: 72810c0e7e76ef94bf03640b7077fea2c44e24e4
5
5
  SHA512:
6
- metadata.gz: 6f636aee28968fd9224d7152f5491ad90a8ac94944dfa17e117307df4fa99954817844139797f485335ceef269de6147e9bedffd0edad84f88f5667543f24856
7
- data.tar.gz: 106eca6660cda8a3d17e6febee0e26fa4870be656a93be747180d94ed2c7f651c584c413fb68f3cb9840d34102c0023dceb70f3a092f6e717f3579be0daeb1b4
6
+ metadata.gz: f52cb8801ac36105e978471d36db316b30990e840c68a27a4b02d137c02b617ce13b9874673421ffff6df31248bd5b9b0949dfae568795a60687f44b8a43a5b9
7
+ data.tar.gz: fa7e6eaa280153ab50998c1a6af14b63c83139f93f4fdcc2f74acabf3c6a8277853cf6dec0538251207923d8d4cd3be6fc4206f9a0f1445b89fe7d3872af1e29
@@ -5,7 +5,7 @@ require "wes/data/api/configuration"
5
5
  module Wes
6
6
  module Data
7
7
  module API
8
- VERSION = "6.1.0".freeze
8
+ VERSION = "6.2.0".freeze
9
9
  end
10
10
  end
11
11
  end
@@ -10,16 +10,22 @@ module Wes
10
10
  end
11
11
 
12
12
  def build
13
- raise unexpected_error unless response.body
14
- raise api_error unless response.status == 200
13
+ raise unexpected_error unless valid_response(response)
14
+ raise api_error unless VALID_RESPONSE_CODES.include?(response.status)
15
15
  data = response.body || {}
16
16
  data.map { |e| OpenStruct.new e }
17
17
  end
18
18
 
19
19
  private
20
20
 
21
+ VALID_RESPONSE_CODES = [200, 204]
22
+
21
23
  attr_reader :response
22
24
 
25
+ def valid_response(response)
26
+ response.body || response.status == 204
27
+ end
28
+
23
29
  def error_details
24
30
  response.body.fetch("details")
25
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wes-data-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-08 00:00:00.000000000 Z
11
+ date: 2016-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler