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 +4 -4
- data/.rubocop.yml +18 -0
- data/.rubocop_todo.yml +0 -42
- data/lib/typesense.rb +2 -0
- data/lib/typesense/api_call.rb +3 -2
- data/lib/typesense/client.rb +4 -0
- data/lib/typesense/documents.rb +4 -0
- data/lib/typesense/health.rb +15 -0
- data/lib/typesense/metrics.rb +15 -0
- data/lib/typesense/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54f0c8b4934c74669d91b10ed2a2fb6d9b3b54db1c72271eaef97062eec5475e
|
4
|
+
data.tar.gz: 86aac1db6163de619c2aefc95c430dee2917f0db0c4f7d57921ae1ff2d78ab03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ecef532b4f623d2acbf1c591e0843ee2cff2bf95c70014d2c00f4b723b9cc5201eabd73d3119c2bcd71167a76fec1a98a9d32bef0fa4d42af91be39cfafdde2
|
7
|
+
data.tar.gz: 6d351095aa8ce2dca828f3f784d76f1f5bba65557e3afcedad3532a496200b59cb68481b3f7e903af26c82e95923bdbb04fe0367de7876e82287f057a933b305
|
data/.rubocop.yml
CHANGED
@@ -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
|
data/.rubocop_todo.yml
CHANGED
@@ -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
|
data/lib/typesense.rb
CHANGED
data/lib/typesense/api_call.rb
CHANGED
@@ -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
|
-
|
86
|
-
|
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,
|
data/lib/typesense/client.rb
CHANGED
@@ -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
|
data/lib/typesense/documents.rb
CHANGED
@@ -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
|
|
data/lib/typesense/version.rb
CHANGED
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.
|
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-
|
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
|