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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce66837409a954f745ea6d4e79a7695a12fe2ee3cd3a4fb9d8b9902635350446
4
- data.tar.gz: f44e7bd38aaa96ced1e4d426b750b36e3b7c3498b2a1174a259bb921ce84e90b
3
+ metadata.gz: 8e666bacc203286b9f67f13ce77a40f838d5fe3f95a1a96826b8e6bf60baf1ea
4
+ data.tar.gz: 3e8ba2f84e7e5b5e68d9e64cc6291f39a5a33474ebd85ca360b554983053cf00
5
5
  SHA512:
6
- metadata.gz: 916f7b8a6891a0391fbd6969caf8bdab0247cd17d36385e6f655cf0dc1a9a9165f1d9de896ed781c3f62a6d94b11f5a22c017ad45d293be885531be3e282d553
7
- data.tar.gz: 1084c46316daa2fbcfd5bd6d0e3d62b012a40c3ebf7314c3a9329b031a562d720edfdcf5f611951dfcc66d5b7bcc2b40b56eb77ab23869747aaf5484ba78225e
6
+ metadata.gz: 69a681cc8036728a6f60b3935f49cfb3044308e66e9e2cfa4825359742a17d0e9f470861b6df0ced8f992a1d158667b5ce8a0a65f814799a82761b74abb357f2
7
+ data.tar.gz: 48232029cb17ab4df1d9d6ba072cc8a4f4b89415b0f3787bcd0f0d94d02ceaeb2518ad12b47e55c5b636ea283f17a8a4764736d2d19dfd60e1c69a4271c61135
@@ -33,6 +33,12 @@ module Exa
33
33
  subpages Integer
34
34
  subpage_target String, as: :subpageTarget
35
35
 
36
+ # extras
37
+ extras do
38
+ links Integer
39
+ image_links Integer, as: :imageLinks
40
+ end
41
+
36
42
  end
37
43
 
38
44
  def self.build( options = nil, &block )
@@ -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
- @error_description = attributes[ :error ] if attributes&.respond_to?( :[] ) && attributes[ :error ]
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
- "Invalid request parameters, malformed JSON, or missing required fields." ]
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
- "Missing or invalid API key." ]
26
+ "The API key is missing or invalid." ]
24
27
  when 403
25
28
  [ :forbidden_error,
26
- "Valid API key but insufficient permissions or rate limit exceeded." ]
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
- "Resource already exists." ]
36
+ "The requested resource already exists." ]
33
37
  when 429
34
38
  [ :rate_limit_error,
35
- "Rate limit exceeded." ]
39
+ "The rate limit has been exceeded." ]
36
40
  when 500..599
37
41
  [ :server_error,
38
- "An error occurred on the Exa servers." ]
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, "An 'api_key' is required unless configured using 'Exa.api_key'." \
10
- unless @api_key
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
@@ -1,3 +1,3 @@
1
1
  module Exa
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exa-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristoph Cichocki-Romanov