cb-api 13.0.0 → 13.0.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,12 +3,13 @@ module Cb
|
|
3
3
|
class Recommendations < ApiResponse
|
4
4
|
|
5
5
|
def validate_api_hash
|
6
|
+
check_nonstandard_error_node(response)
|
6
7
|
required_response_field(root_node, response)
|
7
8
|
required_response_field('results', response[root_node])
|
8
9
|
end
|
9
10
|
|
10
11
|
def hash_containing_metadata
|
11
|
-
|
12
|
+
nil
|
12
13
|
end
|
13
14
|
|
14
15
|
def extract_models
|
@@ -18,6 +19,12 @@ module Cb
|
|
18
19
|
def root_node
|
19
20
|
'data'
|
20
21
|
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def check_nonstandard_error_node(api_response)
|
26
|
+
fail ApiResponseError.new(api_response['Message']) if api_response.include?('Message')
|
27
|
+
end
|
21
28
|
end
|
22
29
|
end
|
23
30
|
end
|
@@ -35,7 +35,6 @@ module Cb
|
|
35
35
|
def raise_on_timing_parse_error
|
36
36
|
true
|
37
37
|
end
|
38
|
-
|
39
38
|
def required_response_field(field_name, parent_hash)
|
40
39
|
raise ArgumentError.new("field_name can't be nil!") if field_name.nil?
|
41
40
|
raise ArgumentError.new("parent_hash can't be nil!") if parent_hash.nil?
|
@@ -51,7 +50,7 @@ module Cb
|
|
51
50
|
end
|
52
51
|
|
53
52
|
def extract_metadata
|
54
|
-
Metadata.new(hash_containing_metadata, raise_on_timing_parse_error)
|
53
|
+
Metadata.new(hash_containing_metadata, raise_on_timing_parse_error) unless hash_containing_metadata.nil?
|
55
54
|
end
|
56
55
|
|
57
56
|
def validated_models
|
data/lib/cb/version.rb
CHANGED