typesense 0.5.0 → 0.5.5

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: ec69deb240d0c343346d128161aa74fe12ab18e7f79007dfa24ac16738c46237
4
- data.tar.gz: e681fcd5f9b1241054f3c786ee5e6eebad45c1ddc1705311bf7a45ea6551a23f
3
+ metadata.gz: 54f0c8b4934c74669d91b10ed2a2fb6d9b3b54db1c72271eaef97062eec5475e
4
+ data.tar.gz: 86aac1db6163de619c2aefc95c430dee2917f0db0c4f7d57921ae1ff2d78ab03
5
5
  SHA512:
6
- metadata.gz: f6dd0dfd751499e1ec32cfd45935038df7ad219c498f433745fd8855439ef5136a7df7c47491f37fa9940d8bc1f1d02cfcc5aa77f6c4a154256f6ebe4dcb5c32
7
- data.tar.gz: 7ef2d64aa701054a756222bc18dc19c9b3e282dbb6cc8789a47fe901d5716d67faaacf0c8fe1ed5b3de7cf1f06a1af11621e77ec633a4dfb6722e5bb0ed6908f
6
+ metadata.gz: 6ecef532b4f623d2acbf1c591e0843ee2cff2bf95c70014d2c00f4b723b9cc5201eabd73d3119c2bcd71167a76fec1a98a9d32bef0fa4d42af91be39cfafdde2
7
+ data.tar.gz: 6d351095aa8ce2dca828f3f784d76f1f5bba65557e3afcedad3532a496200b59cb68481b3f7e903af26c82e95923bdbb04fe0367de7876e82287f057a933b305
@@ -14,3 +14,21 @@ Metrics/BlockLength:
14
14
 
15
15
  Style/Documentation:
16
16
  Enabled: false
17
+
18
+ RSpec/ExampleLength:
19
+ Enabled: false
20
+
21
+ Metrics/MethodLength:
22
+ Enabled: false
23
+
24
+ Metrics/AbcSize:
25
+ Enabled: false
26
+
27
+ Metrics/ClassLength:
28
+ Enabled: false
29
+
30
+ Metrics/CyclomaticComplexity:
31
+ Enabled: false
32
+
33
+ Metrics/PerceivedComplexity:
34
+ Enabled: false
@@ -19,48 +19,6 @@ Lint/SuppressedException:
19
19
  - 'examples/search.rb'
20
20
  - 'examples/keys.rb'
21
21
 
22
- # Offense count: 3
23
- # Configuration parameters: IgnoredMethods.
24
- Metrics/AbcSize:
25
- Max: 43
26
-
27
- # Offense count: 1
28
- # Configuration parameters: CountComments.
29
- Metrics/ClassLength:
30
- Max: 184
31
-
32
- # Offense count: 3
33
- # Configuration parameters: IgnoredMethods.
34
- Metrics/CyclomaticComplexity:
35
- Max: 11
36
-
37
- # Offense count: 5
38
- # Configuration parameters: CountComments, ExcludedMethods.
39
- Metrics/MethodLength:
40
- Max: 29
41
-
42
- # Offense count: 3
43
- # Configuration parameters: IgnoredMethods.
44
- Metrics/PerceivedComplexity:
45
- Max: 11
46
-
47
- # Offense count: 25
48
- # Configuration parameters: Max.
49
- RSpec/ExampleLength:
50
- Exclude:
51
- - 'spec/typesense/alias_spec.rb'
52
- - 'spec/typesense/aliases_spec.rb'
53
- - 'spec/typesense/key_spec.rb'
54
- - 'spec/typesense/keys_spec.rb'
55
- - 'spec/typesense/api_call_spec.rb'
56
- - 'spec/typesense/collection_spec.rb'
57
- - 'spec/typesense/collections_spec.rb'
58
- - 'spec/typesense/debug_spec.rb'
59
- - 'spec/typesense/document_spec.rb'
60
- - 'spec/typesense/documents_spec.rb'
61
- - 'spec/typesense/override_spec.rb'
62
- - 'spec/typesense/overrides_spec.rb'
63
-
64
22
  # Offense count: 10
65
23
  RSpec/MultipleExpectations:
66
24
  Max: 5
@@ -18,4 +18,6 @@ require_relative 'typesense/alias'
18
18
  require_relative 'typesense/keys'
19
19
  require_relative 'typesense/key'
20
20
  require_relative 'typesense/debug'
21
+ require_relative 'typesense/health'
22
+ require_relative 'typesense/metrics'
21
23
  require_relative 'typesense/error'
@@ -82,8 +82,9 @@ module Typesense
82
82
  # If response is 2xx return the object, else raise the response as an exception
83
83
  return response_object.parsed_response if response_object.response.code_type <= Net::HTTPSuccess # 2xx
84
84
 
85
- raise custom_exception_klass_for(response_object.response), response_object.parsed_response['message'] || 'Error message not available'
86
- rescue Net::ReadTimeout, Net::OpenTimeout,
85
+ exception_message = (response_object.parsed_response && response_object.parsed_response['message']) || 'Error'
86
+ raise custom_exception_klass_for(response_object.response), exception_message
87
+ rescue SocketError, Net::ReadTimeout, Net::OpenTimeout,
87
88
  EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError,
88
89
  Errno::EINVAL, Errno::ENETDOWN, Errno::ENETUNREACH, Errno::ENETRESET, Errno::ECONNABORTED, Errno::ECONNRESET,
89
90
  Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::EHOSTDOWN, Errno::EHOSTUNREACH,
@@ -7,6 +7,8 @@ module Typesense
7
7
  attr_reader :aliases
8
8
  attr_reader :keys
9
9
  attr_reader :debug
10
+ attr_reader :health
11
+ attr_reader :metrics
10
12
 
11
13
  def initialize(options = {})
12
14
  @configuration = Configuration.new(options)
@@ -15,6 +17,8 @@ module Typesense
15
17
  @aliases = Aliases.new(@api_call)
16
18
  @keys = Keys.new(@api_call)
17
19
  @debug = Debug.new(@api_call)
20
+ @health = Health.new(@api_call)
21
+ @metrics = Metrics.new(@api_call)
18
22
  end
19
23
  end
20
24
  end
@@ -16,6 +16,10 @@ module Typesense
16
16
 
17
17
  def create_many(documents)
18
18
  documents_in_jsonl_format = documents.map { |document| JSON.dump(document) }.join("\n")
19
+ import(documents_in_jsonl_format)
20
+ end
21
+
22
+ def import(documents_in_jsonl_format)
19
23
  @api_call.post(endpoint_path('import'), as_json: false, body: documents_in_jsonl_format)
20
24
  end
21
25
 
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Typesense
4
+ class Health
5
+ RESOURCE_PATH = '/health'
6
+
7
+ def initialize(api_call)
8
+ @api_call = api_call
9
+ end
10
+
11
+ def retrieve
12
+ @api_call.get(RESOURCE_PATH)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Typesense
4
+ class Metrics
5
+ RESOURCE_PATH = '/metrics.json'
6
+
7
+ def initialize(api_call)
8
+ @api_call = api_call
9
+ end
10
+
11
+ def retrieve
12
+ @api_call.get(RESOURCE_PATH)
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Typesense
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typesense
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Typesense, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-31 00:00:00.000000000 Z
11
+ date: 2020-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -244,8 +244,10 @@ files:
244
244
  - lib/typesense/document.rb
245
245
  - lib/typesense/documents.rb
246
246
  - lib/typesense/error.rb
247
+ - lib/typesense/health.rb
247
248
  - lib/typesense/key.rb
248
249
  - lib/typesense/keys.rb
250
+ - lib/typesense/metrics.rb
249
251
  - lib/typesense/override.rb
250
252
  - lib/typesense/overrides.rb
251
253
  - lib/typesense/version.rb