elastic-app-search 0.7.0 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +23 -12
- data/README.md +30 -1
- data/lib/elastic/app-search/exceptions.rb +1 -1
- data/lib/elastic/app-search/version.rb +1 -1
- data/spec/client_spec.rb +3 -2
- metadata +3 -4
- data/.travis.yml +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ad91d2a33d9f54d5ee8fc870a8a106cf7d0b3b3351b9920130932c06ae09a21b
|
4
|
+
data.tar.gz: 3d38cc89d75dff5d8e03f3ad3326636ae84b3fb5d703494e1eac173396ada939
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9060edf116f45ca45c19f152a980325f7f480f74de6c85694bd22dd203746f21cc6f307991592b6a8675d7fb9d0505d69dcbb8beff20b4ec4ad71c70022d99cf
|
7
|
+
data.tar.gz: 04a7789fa959203fa4cacb0cb310428af8988d83f9c954e2b7165d13a2cc5222c47ce98abf33747cdf17198d362f7a482d9121c050fd43fb4db5caab0b550339
|
data/.circleci/config.yml
CHANGED
@@ -2,17 +2,20 @@
|
|
2
2
|
#
|
3
3
|
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
4
|
#
|
5
|
-
version: 2
|
5
|
+
version: 2.1
|
6
|
+
|
7
|
+
executors:
|
8
|
+
ruby-24: { docker: [{ image: "ruby:2.4" }] }
|
9
|
+
ruby-25: { docker: [{ image: "ruby:2.5" }] }
|
10
|
+
ruby-26: { docker: [{ image: "ruby:2.6" }] }
|
11
|
+
jruby-92: { docker: [{ image: "jruby:9.2.7-jdk" }] }
|
12
|
+
|
6
13
|
jobs:
|
7
14
|
build:
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
15
|
+
parameters:
|
16
|
+
executor:
|
17
|
+
type: executor
|
18
|
+
executor: << parameters.executor >>
|
16
19
|
|
17
20
|
working_directory: ~/repo
|
18
21
|
|
@@ -22,9 +25,9 @@ jobs:
|
|
22
25
|
# Download and cache dependencies
|
23
26
|
- restore_cache:
|
24
27
|
keys:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
+
- v1-dependencies-{{ checksum "Gemfile" }}
|
29
|
+
# fallback to using the latest cache if no exact match is found
|
30
|
+
- v1-dependencies-
|
28
31
|
|
29
32
|
- run:
|
30
33
|
name: install dependencies
|
@@ -54,3 +57,11 @@ jobs:
|
|
54
57
|
- store_artifacts:
|
55
58
|
path: /tmp/test-results
|
56
59
|
destination: test-results
|
60
|
+
|
61
|
+
workflows:
|
62
|
+
run-tests:
|
63
|
+
jobs:
|
64
|
+
- build: { name: run-tests-ruby-2.4, executor: ruby-24 }
|
65
|
+
- build: { name: run-tests-ruby-2.5, executor: ruby-25 }
|
66
|
+
- build: { name: run-tests-ruby-2.6, executor: ruby-26 }
|
67
|
+
- build: { name: run-tests-jruby-92, executor: jruby-92 }
|
data/README.md
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
## Contents
|
8
8
|
|
9
9
|
- [Getting started](#getting-started-)
|
10
|
+
- [Versioning](#versioning)
|
10
11
|
- [Usage](#usage)
|
11
12
|
- [Running Tests](#running-tests)
|
12
13
|
- [Debugging API Calls](#debugging-api-calls)
|
@@ -24,7 +25,17 @@ To install the gem, execute:
|
|
24
25
|
gem install elastic-app-search
|
25
26
|
```
|
26
27
|
|
27
|
-
Or place `gem 'elastic-app-search', '~>
|
28
|
+
Or place `gem 'elastic-app-search', '~> 7.2.0'` in your `Gemfile` and run `bundle install`.
|
29
|
+
|
30
|
+
## Versioning
|
31
|
+
|
32
|
+
This client is versioned and released alongside App Search.
|
33
|
+
|
34
|
+
To guarantee compatibility, use the most recent version of this library within the major version of the corresponding App Search implementation.
|
35
|
+
|
36
|
+
For example, for App Search `7.3`, use `7.3` of this library or above, but not `8.0`.
|
37
|
+
|
38
|
+
If you are a [SaaS](https://app.swiftype.com/as) user, simply use the most recent version of this library.
|
28
39
|
|
29
40
|
## Usage
|
30
41
|
|
@@ -263,6 +274,24 @@ engine_name = 'favorite-videos'
|
|
263
274
|
client.reset_settings(engine_name)
|
264
275
|
```
|
265
276
|
|
277
|
+
#### Create a Signed Search Key
|
278
|
+
|
279
|
+
Creating a search key that will only return the title field.
|
280
|
+
|
281
|
+
```ruby
|
282
|
+
public_search_key = 'search-xxxxxxxxxxxxxxxxxxxxxxxx'
|
283
|
+
public_search_key_name = 'search-key'
|
284
|
+
enforced_options = {
|
285
|
+
result_fields: { title: { raw: {} } },
|
286
|
+
filters: { world_heritage_site: 'true' }
|
287
|
+
}
|
288
|
+
|
289
|
+
signed_search_key = Elastic::AppSearch::Client.create_signed_search_key(public_search_key, public_search_key_name, enforced_options)
|
290
|
+
|
291
|
+
client = Elastic::AppSearch::Client.new(host_identifier: 'host-c5s2mj', api_key: signed_search_key)
|
292
|
+
client.search('national-parks-demo', 'everglade')
|
293
|
+
```
|
294
|
+
|
266
295
|
## Running Tests
|
267
296
|
|
268
297
|
```bash
|
@@ -9,7 +9,7 @@ module Elastic
|
|
9
9
|
else
|
10
10
|
response['errors'] || [response]
|
11
11
|
end
|
12
|
-
message = (errors.
|
12
|
+
message = (errors.size == 1) ? "Error: #{errors.first}" : "Errors: #{errors.inspect}"
|
13
13
|
super(message)
|
14
14
|
end
|
15
15
|
end
|
data/spec/client_spec.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'config_helper'
|
2
|
+
require 'securerandom'
|
2
3
|
|
3
4
|
describe Elastic::AppSearch::Client do
|
4
|
-
let(:engine_name) { "ruby-client-test-#{
|
5
|
+
let(:engine_name) { "ruby-client-test-#{SecureRandom.hex}" }
|
5
6
|
|
6
7
|
include_context 'App Search Credentials'
|
7
8
|
let(:client) { Elastic::AppSearch::Client.new(client_options) }
|
@@ -9,7 +10,7 @@ describe Elastic::AppSearch::Client do
|
|
9
10
|
before(:all) do
|
10
11
|
# Bootstraps a static engine for 'read-only' options that require indexing
|
11
12
|
# across the test suite
|
12
|
-
@static_engine_name = "ruby-client-test-static-#{
|
13
|
+
@static_engine_name = "ruby-client-test-static-#{SecureRandom.hex}"
|
13
14
|
as_api_key = ConfigHelper.get_as_api_key
|
14
15
|
as_host_identifier = ConfigHelper.get_as_host_identifier
|
15
16
|
as_api_endpoint = ConfigHelper.get_as_api_endpoint
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-app-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Quin Hoxie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -97,7 +97,6 @@ files:
|
|
97
97
|
- ".gitignore"
|
98
98
|
- ".rspec"
|
99
99
|
- ".rubocop.yml"
|
100
|
-
- ".travis.yml"
|
101
100
|
- Gemfile
|
102
101
|
- LICENSE.txt
|
103
102
|
- NOTICE.txt
|
@@ -141,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
140
|
version: '0'
|
142
141
|
requirements: []
|
143
142
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.7.6
|
145
144
|
signing_key:
|
146
145
|
specification_version: 4
|
147
146
|
summary: Official gem for accessing the Elastic App Search API
|