typesense 0.14.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +27 -0
- data/README.md +2 -1
- data/examples/collections_and_documents.rb +0 -1
- data/lib/typesense/analytics.rb +15 -0
- data/lib/typesense/analytics_rule.rb +24 -0
- data/lib/typesense/analytics_rules.rb +30 -0
- data/lib/typesense/client.rb +3 -1
- data/lib/typesense/preset.rb +24 -0
- data/lib/typesense/presets.rb +30 -0
- data/lib/typesense/version.rb +1 -1
- data/lib/typesense.rb +5 -0
- metadata +9 -4
- data/.circleci/config.yml +0 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b0902a6b96d21122114a769a6d55c55cba28880ace9b116a1e3c67251148bc9
|
4
|
+
data.tar.gz: 5b8bec6c747b00d61ed1028569272519d724b3262b3753753a2fea0c4b5db972
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 298131cd62bb16c8fc26797eb06ffb09689ec98553ef77ba3bd4811aff5f46de777bd6a9a62ac13665d95800189456557e741b89fbbec3911adc0ddd1cd008d3
|
7
|
+
data.tar.gz: db2215ce53918e3e37800ba596a0a7eb7a4b75127d266cf7081e94c6bfac87834ce881d6082c850041fff755ab9436f72de0f1e5f50d25b99f047f84819ed1fc
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: tests
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
permissions:
|
6
|
+
contents: read
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build_and_test:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
ruby-version: ['2.6', '2.7', '3.0']
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby-version }}
|
20
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
21
|
+
- run: bundle exec rubocop
|
22
|
+
- run: bundle exec rspec --format documentation
|
23
|
+
- uses: actions/upload-artifact@v3
|
24
|
+
with:
|
25
|
+
name: coverage
|
26
|
+
path: coverage/
|
27
|
+
retention-days: 1
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Typesense Ruby Library [![Gem Version](https://badge.fury.io/rb/typesense.svg)](https://badge.fury.io/rb/typesense)
|
1
|
+
# Typesense Ruby Library [![Gem Version](https://badge.fury.io/rb/typesense.svg)](https://badge.fury.io/rb/typesense)
|
2
2
|
|
3
3
|
|
4
4
|
Ruby client library for accessing the [Typesense HTTP API](https://github.com/typesense/typesense).
|
@@ -33,6 +33,7 @@ Tests are also a good place to know how the the library works internally: [spec]
|
|
33
33
|
|
34
34
|
| Typesense Server | typesense-ruby |
|
35
35
|
|------------------|----------------|
|
36
|
+
| \>= v0.25.0 | \>= v0.15.0 |
|
36
37
|
| \>= v0.23.0 | \>= v0.14.0 |
|
37
38
|
| \>= v0.21.0 | \>= v0.13.0 |
|
38
39
|
| \>= v0.20.0 | \>= v0.12.0 |
|
@@ -187,7 +187,6 @@ ap document
|
|
187
187
|
##
|
188
188
|
# Update a document. Unlike upsert, update will error out if the doc doesn't already exist.
|
189
189
|
document = @typesense.collections['companies'].documents['124'].update(
|
190
|
-
'id' => 1,
|
191
190
|
'num_employees' => 5500
|
192
191
|
)
|
193
192
|
ap document
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Typesense
|
4
|
+
class AnalyticsRule
|
5
|
+
def initialize(rule_name, api_call)
|
6
|
+
@rule_name = rule_name
|
7
|
+
@api_call = api_call
|
8
|
+
end
|
9
|
+
|
10
|
+
def retrieve
|
11
|
+
@api_call.get(endpoint_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete
|
15
|
+
@api_call.delete(endpoint_path)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def endpoint_path
|
21
|
+
"#{AnalyticsRules::RESOURCE_PATH}/#{@rule_name}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Typesense
|
4
|
+
class AnalyticsRules
|
5
|
+
RESOURCE_PATH = '/analytics/rules'
|
6
|
+
|
7
|
+
def initialize(api_call)
|
8
|
+
@api_call = api_call
|
9
|
+
@analytics_rules = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def upsert(rule_name, params)
|
13
|
+
@api_call.put(endpoint_path(rule_name), params)
|
14
|
+
end
|
15
|
+
|
16
|
+
def retrieve
|
17
|
+
@api_call.get(endpoint_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def [](rule_name)
|
21
|
+
@analytics_rules[rule_name] ||= AnalyticsRule.new(rule_name, @api_call)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def endpoint_path(operation = nil)
|
27
|
+
"#{AnalyticsRules::RESOURCE_PATH}#{operation.nil? ? '' : "/#{operation}"}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/typesense/client.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Typesense
|
4
4
|
class Client
|
5
5
|
attr_reader :configuration, :collections, :aliases, :keys, :debug, :health, :metrics, :operations,
|
6
|
-
:multi_search
|
6
|
+
:multi_search, :analytics, :presets
|
7
7
|
|
8
8
|
def initialize(options = {})
|
9
9
|
@configuration = Configuration.new(options)
|
@@ -16,6 +16,8 @@ module Typesense
|
|
16
16
|
@health = Health.new(@api_call)
|
17
17
|
@metrics = Metrics.new(@api_call)
|
18
18
|
@operations = Operations.new(@api_call)
|
19
|
+
@analytics = Analytics.new(@api_call)
|
20
|
+
@presets = Presets.new(@api_call)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Typesense
|
4
|
+
class Preset
|
5
|
+
def initialize(preset_name, api_call)
|
6
|
+
@preset_name = preset_name
|
7
|
+
@api_call = api_call
|
8
|
+
end
|
9
|
+
|
10
|
+
def retrieve
|
11
|
+
@api_call.get(endpoint_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete
|
15
|
+
@api_call.delete(endpoint_path)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def endpoint_path
|
21
|
+
"#{Presets::RESOURCE_PATH}/#{@preset_name}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Typesense
|
4
|
+
class Presets
|
5
|
+
RESOURCE_PATH = '/presets'
|
6
|
+
|
7
|
+
def initialize(api_call)
|
8
|
+
@api_call = api_call
|
9
|
+
@presets = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def upsert(preset_name, params)
|
13
|
+
@api_call.put(endpoint_path(preset_name), params)
|
14
|
+
end
|
15
|
+
|
16
|
+
def retrieve
|
17
|
+
@api_call.get(endpoint_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def [](preset_name)
|
21
|
+
@presets[preset_name] ||= Preset.new(preset_name, @api_call)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def endpoint_path(operation = nil)
|
27
|
+
"#{Presets::RESOURCE_PATH}#{operation.nil? ? '' : "/#{operation}"}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/typesense/version.rb
CHANGED
data/lib/typesense.rb
CHANGED
@@ -20,6 +20,11 @@ require_relative 'typesense/alias'
|
|
20
20
|
require_relative 'typesense/keys'
|
21
21
|
require_relative 'typesense/key'
|
22
22
|
require_relative 'typesense/multi_search'
|
23
|
+
require_relative 'typesense/analytics'
|
24
|
+
require_relative 'typesense/analytics_rules'
|
25
|
+
require_relative 'typesense/analytics_rule'
|
26
|
+
require_relative 'typesense/presets'
|
27
|
+
require_relative 'typesense/preset'
|
23
28
|
require_relative 'typesense/debug'
|
24
29
|
require_relative 'typesense/health'
|
25
30
|
require_relative 'typesense/metrics'
|
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.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Typesense, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -256,7 +256,7 @@ executables: []
|
|
256
256
|
extensions: []
|
257
257
|
extra_rdoc_files: []
|
258
258
|
files:
|
259
|
-
- ".
|
259
|
+
- ".github/workflows/tests.yml"
|
260
260
|
- ".gitignore"
|
261
261
|
- ".rspec"
|
262
262
|
- ".rubocop.yml"
|
@@ -278,6 +278,9 @@ files:
|
|
278
278
|
- lib/typesense.rb
|
279
279
|
- lib/typesense/alias.rb
|
280
280
|
- lib/typesense/aliases.rb
|
281
|
+
- lib/typesense/analytics.rb
|
282
|
+
- lib/typesense/analytics_rule.rb
|
283
|
+
- lib/typesense/analytics_rules.rb
|
281
284
|
- lib/typesense/api_call.rb
|
282
285
|
- lib/typesense/client.rb
|
283
286
|
- lib/typesense/collection.rb
|
@@ -295,6 +298,8 @@ files:
|
|
295
298
|
- lib/typesense/operations.rb
|
296
299
|
- lib/typesense/override.rb
|
297
300
|
- lib/typesense/overrides.rb
|
301
|
+
- lib/typesense/preset.rb
|
302
|
+
- lib/typesense/presets.rb
|
298
303
|
- lib/typesense/synonym.rb
|
299
304
|
- lib/typesense/synonyms.rb
|
300
305
|
- lib/typesense/version.rb
|
@@ -318,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
318
323
|
- !ruby/object:Gem::Version
|
319
324
|
version: '0'
|
320
325
|
requirements: []
|
321
|
-
rubygems_version: 3.
|
326
|
+
rubygems_version: 3.0.9
|
322
327
|
signing_key:
|
323
328
|
specification_version: 4
|
324
329
|
summary: Ruby Library for Typesense
|
data/.circleci/config.yml
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# Ruby CircleCI 2.0 configuration file
|
2
|
-
#
|
3
|
-
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
-
#
|
5
|
-
version: 2
|
6
|
-
jobs:
|
7
|
-
build:
|
8
|
-
docker:
|
9
|
-
# specify the version you desire here
|
10
|
-
- image: circleci/ruby:2.4.1-node-browsers
|
11
|
-
|
12
|
-
# Specify service dependencies here if necessary
|
13
|
-
# CircleCI maintains a library of pre-built images
|
14
|
-
# documented at https://circleci.com/docs/2.0/circleci-images/
|
15
|
-
# - image: circleci/postgres:9.4
|
16
|
-
|
17
|
-
working_directory: ~/repo
|
18
|
-
|
19
|
-
steps:
|
20
|
-
- checkout
|
21
|
-
|
22
|
-
# # Download and cache dependencies
|
23
|
-
# - restore_cache:
|
24
|
-
# keys:
|
25
|
-
# - v1-dependencies-{{ checksum "Gemfile.lock" }}
|
26
|
-
# # fallback to using the latest cache if no exact match is found
|
27
|
-
# - v1-dependencies-
|
28
|
-
|
29
|
-
- run:
|
30
|
-
name: install bundler
|
31
|
-
command: |
|
32
|
-
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
|
33
|
-
source $BASH_ENV
|
34
|
-
gem install bundler
|
35
|
-
|
36
|
-
- run:
|
37
|
-
name: install dependencies
|
38
|
-
command: |
|
39
|
-
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
40
|
-
|
41
|
-
# - save_cache:
|
42
|
-
# paths:
|
43
|
-
# - ./vendor/bundle
|
44
|
-
# key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
45
|
-
|
46
|
-
- run:
|
47
|
-
name: lint
|
48
|
-
command: |
|
49
|
-
bundle exec rubocop
|
50
|
-
|
51
|
-
# run tests!
|
52
|
-
- run:
|
53
|
-
name: run tests
|
54
|
-
command: |
|
55
|
-
mkdir /tmp/test-results
|
56
|
-
|
57
|
-
bundle exec rspec --format documentation \
|
58
|
-
--format RspecJunitFormatter \
|
59
|
-
--out /tmp/test-results/rspec.xml
|
60
|
-
|
61
|
-
# collect reports
|
62
|
-
- store_test_results:
|
63
|
-
path: /tmp/test-results
|
64
|
-
- store_artifacts:
|
65
|
-
path: /tmp/test-results
|
66
|
-
destination: test-results
|
67
|
-
- store_artifacts:
|
68
|
-
path: coverage
|
69
|
-
destination: coverage
|