meilisearch 0.32.0 → 0.33.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: 10979c6d34127afb63d73049967287282428a19ae0d0da81e318ebecbdd5061a
4
- data.tar.gz: 5ab882422d999ad86bba6b7b4278b511ca63e47292b9a02c2d3ee62adcecb1a0
3
+ metadata.gz: e9ae113cf3a2e76decccea64b9bcd1a0402c56c22af08eecbc3ad4e022db482b
4
+ data.tar.gz: 6ee5da205a21e8343e4fcb64ffc51e9919feab370349a86b51efebde086f0195
5
5
  SHA512:
6
- metadata.gz: d9dfc97758734f2501107df819bb4a2a260af515acce221726a042dc193f3cd1abc3a7d7eaed0cdd218c549aad6b63fc6d661940fc7395fa6180a5d5293844c0
7
- data.tar.gz: 370ceb4c95bfa7bc3df49a780edc030d22469898cc325eba7a00db6d2275a39c1af98e49cf77ea4779d9823768d7b79b851449930e9c73d8d526cec8948a1a3e
6
+ metadata.gz: 7594ebc7211f25bac52762dd9c0081e21979d604045c8e82d4e4ec0e1162eb826ff7c8fc1a27138e5487f2c0c64aba37c48c3a00c5e67f7d1c315e248333ae0c
7
+ data.tar.gz: 7898077e4b8aa6d3ae2e87e6238815f3f807143cde266e6b307a90490038e13dd8171d55b00d30de06392e540168aaf1c25d48e480caea49afc7c2d2c6fde54e
data/README.md CHANGED
@@ -21,7 +21,6 @@
21
21
  <img src="https://codecov.io/gh/meilisearch/meilisearch-ruby/branch/main/graph/badge.svg?token=9J7LRP11IR"/>
22
22
  </a>
23
23
  <a href="https://github.com/meilisearch/meilisearch-ruby/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-informational" alt="License"></a>
24
- <a href="https://ms-bors.herokuapp.com/repositories/6"><img src="https://bors.tech/images/badge_small.svg" alt="Bors enabled"></a>
25
24
  </p>
26
25
 
27
26
  <p align="center">⚡ The Meilisearch API client written for Ruby 💎</p>
@@ -41,13 +41,18 @@ module Meilisearch
41
41
  # Multiple swaps may be done with one request:
42
42
  # client.swap_indexes(['a', 'a_swap'], ['b', 'b_swap'])
43
43
  #
44
+ # You can also pass hashes explicitly (renaming supported):
45
+ # client.swap_indexes({ indexes: ['a', 'a_swap'] }, { indexes: ['uid', 'uid_renamed'], rename: true })
46
+ #
47
+ # Renaming requires the target uid to be absent.
48
+ #
44
49
  # @see https://www.meilisearch.com/docs/reference/api/indexes#swap-indexes Meilisearch API reference
45
50
  #
46
- # @param options [Array<Array(String, String)>] the indexes to swap
51
+ # @param options [Array<Array(String, String)>, Array<Hash>] the index pairs to swap
47
52
  # @return [Models::Task] the async task that swaps the indexes
48
53
  # @raise [ApiError]
49
54
  def swap_indexes(*options)
50
- mapped_array = options.map { |arr| { indexes: arr } }
55
+ mapped_array = options.map { |entry| entry.is_a?(Hash) ? entry : { indexes: entry } }
51
56
 
52
57
  response = http_post '/swap-indexes', mapped_array
53
58
  Models::Task.new(response, task_endpoint)
@@ -118,6 +118,10 @@ module Meilisearch
118
118
  response = http_method.call(@base_url + relative_path, request_config)
119
119
  rescue Errno::ECONNREFUSED, Errno::EPIPE => e
120
120
  raise CommunicationError, e.message
121
+ rescue URI::InvalidURIError => e
122
+ raise CommunicationError, "Client URL missing scheme/protocol. Did you mean https://#{@base_url}" unless @base_url =~ %r{^\w+://}
123
+
124
+ raise CommunicationError, e
121
125
  rescue Net::OpenTimeout, Net::ReadTimeout => e
122
126
  attempts += 1
123
127
  raise TimeoutError, e.message unless attempts <= max_retries && safe_to_retry?(config[:method_type], e)