meilisearch 0.26.0 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e182244659129f40ceff661d8e117af391a68aa1cf5fed79f198fc715863ba4e
4
- data.tar.gz: 17f9fd0b3b529829f1bd3d4d39cb3444532ec2cc14b0aebaeac00bae6f217d9b
3
+ metadata.gz: 41cfeec247ef2cdaef19f6ddade5d32b7dcc80cbc69fe500c9310f7dab87e5a4
4
+ data.tar.gz: af889a896d762a38fbb1af56aba3b462cf73f35e4fe97048ef09bbaad44ffa53
5
5
  SHA512:
6
- metadata.gz: 6aefe0097ef3f3c1785f1498ade5508ac77fca3e5aef025931d7ec34e12462419721cd2b7a1ee9d8c5037a36fa0dedd3aeabb35b473a400e05b9880401495149
7
- data.tar.gz: 5b9949303254ca87e378904dadbbf0f7fc77a113cbda175dfb7bb950b674ed09742d411c0fb45cbc3a5626c6c16ebd1549e402b76504016b1e9567e28ba4e084
6
+ metadata.gz: 6ce24688fe857e840d07efda981cc00d0f8a60982aea1d487646b21a82117693eaa61fbe9dc778512b00b7d2363001c68dca0387f7b7a550a00eee022133c046
7
+ data.tar.gz: fda38ae00c08ba533e76dc0ce9a101331b23fb47e6c9554478a6027f1524b92141c6ecc764dce974402e66db67b9e6d85a96ff74893eb3419d0a9f02865b1cec
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019-2022 Meili SAS
3
+ Copyright (c) 2019-2024 Meili SAS
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -53,7 +53,7 @@ Say goodbye to server deployment and manual updates with [Meilisearch Cloud](htt
53
53
 
54
54
  ## 🔧 Installation
55
55
 
56
- This package requires Ruby version 2.6.0 or later.
56
+ This package requires Ruby version 3.0.0 or later.
57
57
 
58
58
  With `gem` in command line:
59
59
  ```bash
@@ -121,6 +121,12 @@ module MeiliSearch
121
121
  http_post '/dumps'
122
122
  end
123
123
 
124
+ ### SNAPSHOTS
125
+
126
+ def create_snapshot
127
+ http_post '/snapshots'
128
+ end
129
+
124
130
  ### TASKS
125
131
 
126
132
  def cancel_tasks(options = {})
@@ -21,26 +21,30 @@ module MeiliSearch
21
21
  alias link ms_link
22
22
 
23
23
  def initialize(http_code, http_message, http_body)
24
- get_meilisearch_error_info(http_body) unless http_body.nil? || http_body.empty?
25
24
  @http_code = http_code
26
25
  @http_message = http_message
27
- @ms_message ||= 'MeiliSearch API has not returned any error message'
28
- @ms_link ||= '<no documentation link found>'
26
+ @http_body = parse_body(http_body)
27
+ @ms_code = @http_body['code']
28
+ @ms_type = @http_body['type']
29
+ @ms_message = @http_body.fetch('message', 'MeiliSearch API has not returned any error message')
30
+ @ms_link = @http_body.fetch('link', '<no documentation link found>')
29
31
  @message = "#{http_code} #{http_message} - #{@ms_message}. See #{ms_link}."
30
32
  super(details)
31
33
  end
32
34
 
33
- def get_meilisearch_error_info(http_body)
34
- @http_body = JSON.parse(http_body)
35
- @ms_code = @http_body['code']
36
- @ms_message = @http_body['message']
37
- @ms_type = @http_body['type']
38
- @ms_link = @http_body['link']
35
+ def parse_body(http_body)
36
+ if http_body.respond_to?(:to_hash)
37
+ http_body.to_hash
38
+ elsif http_body.respond_to?(:to_str)
39
+ JSON.parse(http_body.to_str)
40
+ else
41
+ {}
42
+ end
39
43
  rescue JSON::ParserError
40
44
  # We might receive a JSON::ParserError when, for example, MeiliSearch is running behind
41
45
  # some proxy (ELB or Nginx, for example), and the request timeouts, returning us
42
46
  # a raw HTML body instead of a JSON as we were expecting
43
- @ms_message = "The server has not returned a valid JSON HTTP body: #{http_body}"
47
+ { 'message' => "The server has not returned a valid JSON HTTP body: #{http_body}" }
44
48
  end
45
49
 
46
50
  def details
@@ -514,5 +514,19 @@ module MeiliSearch
514
514
  def reset_non_separator_tokens
515
515
  http_delete("/indexes/#{@uid}/settings/non-separator-tokens")
516
516
  end
517
+
518
+ ### SETTINGS - PROXIMITY PRECISION
519
+
520
+ def proximity_precision
521
+ http_get("/indexes/#{@uid}/settings/proximity-precision")
522
+ end
523
+
524
+ def update_proximity_precision(proximity_precision_attribute)
525
+ http_put("/indexes/#{@uid}/settings/proximity-precision", proximity_precision_attribute)
526
+ end
527
+
528
+ def reset_proximity_precision
529
+ http_delete("/indexes/#{@uid}/settings/proximity-precision")
530
+ end
517
531
  end
518
532
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module MeiliSearch
4
4
  module Utils
5
- SNAKE_CASE = /[^a-zA-Z0-9]+(.)/.freeze
5
+ SNAKE_CASE = /[^a-zA-Z0-9]+(.)/
6
6
 
7
7
  def self.transform_attributes(body)
8
8
  case body
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MeiliSearch
4
- VERSION = '0.26.0'
4
+ VERSION = '0.27.0'
5
5
 
6
6
  def self.qualified_version
7
7
  "Meilisearch Ruby (v#{VERSION})"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meilisearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.0
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Meili
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-11 00:00:00.000000000 Z
11
+ date: 2024-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -51,7 +51,8 @@ files:
51
51
  homepage: https://github.com/meilisearch/meilisearch-ruby
52
52
  licenses:
53
53
  - MIT
54
- metadata: {}
54
+ metadata:
55
+ rubygems_mfa_required: 'true'
55
56
  post_install_message:
56
57
  rdoc_options: []
57
58
  require_paths:
@@ -60,14 +61,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
61
  requirements:
61
62
  - - ">="
62
63
  - !ruby/object:Gem::Version
63
- version: 2.6.0
64
+ version: 3.0.0
64
65
  required_rubygems_version: !ruby/object:Gem::Requirement
65
66
  requirements:
66
67
  - - ">="
67
68
  - !ruby/object:Gem::Version
68
69
  version: '0'
69
70
  requirements: []
70
- rubygems_version: 3.0.3.1
71
+ rubygems_version: 3.2.33
71
72
  signing_key:
72
73
  specification_version: 4
73
74
  summary: An easy-to-use ruby client for Meilisearch API