bwapi 9.0.0.pre.401 → 9.0.0.pre.404
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 +8 -8
- data/lib/bwapi/error.rb +9 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTZiMDM1NjdiNDNkN2JhYjMwZTM2MTQyYzQzOTliYzM5OGI4MTk3Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjVhYzY1NzU3YWI5YmQwYzc2ZjYyOThjNzBmNzYwNTczZGNjNzQ0YQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWIyYmJiZmU1YzU1OWNmODlkYmYwYzdlYzBiYjUxNmFjMjk3N2MyODY4OTk2
|
10
|
+
OWIxMWY1NGFiZGQ5ZmYxYmVmNTRiOWZiMzI0OTA1ZDNjZGRlOTVjODIyMzZk
|
11
|
+
YzUxNTZhZjZiMTA1YTlmYjNlZjNkZTkyNzk1YTYxMDY2M2JmMGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzY3N2JhYjgwM2UwYzY3OTdmNjk4YWIxNTI3OWZkZjE2NmQxMzk1MjE2MTJi
|
14
|
+
NzAyZDFkYzk4MjAyNWZiOTA2YjM5NTNmZjA3NDVjN2U0MjZjNzdjY2E1NzZl
|
15
|
+
YzU3Y2FmNGY1Y2YzODE3OTgzZjQ1MzM2OWYzZGViMDM2YjA5NGE=
|
data/lib/bwapi/error.rb
CHANGED
@@ -13,19 +13,18 @@ module BWAPI
|
|
13
13
|
def valid_response?(response)
|
14
14
|
return nil if response.nil?
|
15
15
|
return nil unless response.body.is_a?(Object) && response.respond_to?(:body)
|
16
|
-
return nil unless response.body.is_a?(
|
17
|
-
|
18
|
-
parse_errors(body) unless body.nil?
|
16
|
+
return nil unless response.body.is_a?(Hash)
|
17
|
+
parse_errors(errors_keys?(response.body)) unless response.body.nil?
|
19
18
|
end
|
20
19
|
|
21
20
|
# Check if response has known errors keys
|
22
21
|
#
|
23
22
|
# @param object [Object] response object to process for errors
|
24
23
|
def errors_keys?(body)
|
25
|
-
if body.error
|
24
|
+
if body.key?('error') && body.key?('error_description')
|
26
25
|
body
|
27
|
-
elsif body.errors
|
28
|
-
body
|
26
|
+
elsif body.key?('errors')
|
27
|
+
body['errors']
|
29
28
|
else
|
30
29
|
nil
|
31
30
|
end
|
@@ -44,9 +43,9 @@ module BWAPI
|
|
44
43
|
def verify_type(type)
|
45
44
|
case type
|
46
45
|
when Array
|
47
|
-
split_array_errors
|
48
|
-
when Hash
|
49
|
-
split_hash_errors
|
46
|
+
split_array_errors(type)
|
47
|
+
when Hash
|
48
|
+
split_hash_errors(type)
|
50
49
|
when String
|
51
50
|
@errors << type
|
52
51
|
end
|
@@ -56,9 +55,7 @@ module BWAPI
|
|
56
55
|
#
|
57
56
|
# @param array [Array] array to iterate
|
58
57
|
def split_array_errors(array)
|
59
|
-
array.each_with_index
|
60
|
-
verify_type array[i]
|
61
|
-
end
|
58
|
+
array.each_with_index { |_e, i| verify_type array[i] }
|
62
59
|
end
|
63
60
|
|
64
61
|
# Iterates through errors in hash
|