exa-rb 1.2.0 → 1.3.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 +4 -4
- data/lib/exa/contents_options.rb +6 -0
- data/lib/exa/error_result.rb +11 -7
- data/lib/exa/request.rb +3 -2
- data/lib/exa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8e666bacc203286b9f67f13ce77a40f838d5fe3f95a1a96826b8e6bf60baf1ea
|
|
4
|
+
data.tar.gz: 3e8ba2f84e7e5b5e68d9e64cc6291f39a5a33474ebd85ca360b554983053cf00
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69a681cc8036728a6f60b3935f49cfb3044308e66e9e2cfa4825359742a17d0e9f470861b6df0ced8f992a1d158667b5ce8a0a65f814799a82761b74abb357f2
|
|
7
|
+
data.tar.gz: 48232029cb17ab4df1d9d6ba072cc8a4f4b89415b0f3787bcd0f0d94d02ceaeb2518ad12b47e55c5b636ea283f17a8a4764736d2d19dfd60e1c69a4271c61135
|
data/lib/exa/contents_options.rb
CHANGED
data/lib/exa/error_result.rb
CHANGED
|
@@ -5,7 +5,9 @@ module Exa
|
|
|
5
5
|
|
|
6
6
|
def initialize( status_code, attributes = nil )
|
|
7
7
|
@error_type, @error_description = status_code_to_error( status_code )
|
|
8
|
-
|
|
8
|
+
if attributes&.respond_to?( :[] ) && attributes[ :error ]
|
|
9
|
+
@error_description = attributes[ :error ]
|
|
10
|
+
end
|
|
9
11
|
end
|
|
10
12
|
|
|
11
13
|
private
|
|
@@ -17,25 +19,27 @@ module Exa
|
|
|
17
19
|
"The response was successful but it did not include a valid payload." ]
|
|
18
20
|
when 400
|
|
19
21
|
[ :invalid_request_error,
|
|
20
|
-
"
|
|
22
|
+
"The request is invalid due to malformed parameters, malformed JSON, or " \
|
|
23
|
+
"missing required fields." ]
|
|
21
24
|
when 401
|
|
22
25
|
[ :authentication_error,
|
|
23
|
-
"
|
|
26
|
+
"The API key is missing or invalid." ]
|
|
24
27
|
when 403
|
|
25
28
|
[ :forbidden_error,
|
|
26
|
-
"
|
|
29
|
+
"The API key is valid but has insufficient permissions or the rate limit " \
|
|
30
|
+
"has been exceeded." ]
|
|
27
31
|
when 404
|
|
28
32
|
[ :not_found_error,
|
|
29
33
|
"The requested resource was not found." ]
|
|
30
34
|
when 409
|
|
31
35
|
[ :conflict_error,
|
|
32
|
-
"
|
|
36
|
+
"The requested resource already exists." ]
|
|
33
37
|
when 429
|
|
34
38
|
[ :rate_limit_error,
|
|
35
|
-
"
|
|
39
|
+
"The rate limit has been exceeded." ]
|
|
36
40
|
when 500..599
|
|
37
41
|
[ :server_error,
|
|
38
|
-
"
|
|
42
|
+
"The Exa server encountered an error while processing the request." ]
|
|
39
43
|
else
|
|
40
44
|
[ :unknown_error,
|
|
41
45
|
"The Exa service returned an unexpected status code: '#{ status_code }'." ]
|
data/lib/exa/request.rb
CHANGED
|
@@ -6,8 +6,9 @@ module Exa
|
|
|
6
6
|
def initialize( connection: nil, api_key: nil )
|
|
7
7
|
@connection = connection || Exa.connection
|
|
8
8
|
@api_key = api_key || Exa.api_key
|
|
9
|
-
raise ArgumentError,
|
|
10
|
-
|
|
9
|
+
raise ArgumentError,
|
|
10
|
+
"The API key is required but was not provided; configure it using " \
|
|
11
|
+
"'Exa.api_key' or pass it directly." unless @api_key
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
protected
|
data/lib/exa/version.rb
CHANGED