dina 1.3.0.0 → 1.3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dina/authentication/authentication.rb +5 -0
- data/lib/dina/search/search_autocomplete.rb +2 -2
- data/lib/dina/search/search_connection.rb +15 -5
- data/lib/dina/search/search_count.rb +0 -2
- data/lib/dina/search/search_mapping.rb +0 -2
- data/lib/dina/version.rb +1 -1
- data/lib/rest_client_request_patch.rb +14 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38688424689df19ac817a13a5f0ef0a1d70ffc75e300f124adee33769faf0be3
|
4
|
+
data.tar.gz: 7e93423153af45f71614d6536fc79dcd7bdb19c1373c515a18927d6cecce08af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 735f7adff9ef6397b5a4e474b1985c8818d948df5160fbc4f121c2b32b1c65c8d3029d3478a9011bb89921ab7f0719d562c32e79b47a6717b4464bdba295fb41
|
7
|
+
data.tar.gz: 6dfc825b17ef3f55cc98298816982de34d19c9fa41c3bf25d56d0b85f82e1714040968210d2f00e7e2e33a579ec8684f6987d9b4f2d30ab934be43b8dda238b1
|
@@ -29,6 +29,7 @@ module Dina
|
|
29
29
|
# endpoint_url: "DINA API URL without terminating slash",
|
30
30
|
# authorization_url: "Keycloak authorization URL without terminating slash".
|
31
31
|
# realm: "provided by DINA admin in Keycloak"
|
32
|
+
# verify_ssl: true
|
32
33
|
# }
|
33
34
|
#
|
34
35
|
# @param options [Hash] the configuration options
|
@@ -51,6 +52,10 @@ module Dina
|
|
51
52
|
Keycloak.auth_server_url = config.authorization_url
|
52
53
|
Keycloak.realm = config.realm
|
53
54
|
|
55
|
+
if opts[:verify_ssl] && opts[:verify_ssl] == false
|
56
|
+
Dina::BaseModel.connection_options[:ssl] = { verify: false }
|
57
|
+
end
|
58
|
+
|
54
59
|
if ::File.zero?(config.token_store_file)
|
55
60
|
save_token(hash: empty_token)
|
56
61
|
end
|
@@ -4,11 +4,11 @@ require_rel 'search_connection'
|
|
4
4
|
#TODO: requires testing, likely failing
|
5
5
|
|
6
6
|
module Dina
|
7
|
-
class
|
7
|
+
class SearchAutoComplete < BaseModel
|
8
8
|
|
9
9
|
self.connection_class = SearchConnection
|
10
10
|
|
11
|
-
custom_endpoint :execute, on: :collection, request_method: :
|
11
|
+
custom_endpoint :execute, on: :collection, request_method: :get
|
12
12
|
|
13
13
|
def self.endpoint_path
|
14
14
|
"search-api/search-ws/"
|
@@ -34,11 +34,12 @@ module Dina
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def run(request_method, path, params: nil, headers: {}, body: nil)
|
37
|
-
#TODO: works for search class, but likely failing for autocomplete, count, and mapping
|
38
|
-
params = {
|
39
|
-
indexName: index_name(index: body[:index])
|
40
|
-
}
|
41
37
|
path.slice!("/execute")
|
38
|
+
if params && params.has_key?(:index)
|
39
|
+
params.merge!(indexName: index_name(index: params[:index]))
|
40
|
+
elsif body && body.has_key?(:index)
|
41
|
+
params = { indexName: index_name(index: body[:index]) }
|
42
|
+
end
|
42
43
|
payload = JSON.generate(body[:payload]) rescue ""
|
43
44
|
|
44
45
|
response = faraday.run_request(request_method, path, body, headers) do |request|
|
@@ -48,7 +49,16 @@ module Dina
|
|
48
49
|
end
|
49
50
|
|
50
51
|
attributes = response.body.dup
|
51
|
-
|
52
|
+
meta = {}
|
53
|
+
if attributes.has_key?("hits")
|
54
|
+
#TODO: does not work with SearchAutoComplete because response is different from Search
|
55
|
+
meta["count"] = attributes["hits"]["total"]["value"] rescue 0
|
56
|
+
elsif attributes.has_key?("count")
|
57
|
+
meta["count"] = attributes["count"]
|
58
|
+
elsif attributes.has_key?("attributes")
|
59
|
+
meta = attributes
|
60
|
+
end
|
61
|
+
response.body["meta"] = meta
|
52
62
|
response.body["errors"] = []
|
53
63
|
response.body["data"] = attributes["hits"]["hits"].map{|d| d["_source"]["data"]} rescue []
|
54
64
|
response
|
data/lib/dina/version.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Keycloak Client depends on RestClient & so verifying SSL must be accommodate here
|
2
|
+
|
3
|
+
module RestClient
|
4
|
+
class Request
|
5
|
+
orig_initialize = instance_method(:initialize)
|
6
|
+
|
7
|
+
define_method(:initialize) do |args|
|
8
|
+
if Dina.config.verify_ssl == false
|
9
|
+
args[:verify_ssl] = false
|
10
|
+
orig_initialize.bind(self).(args)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David P. Shorthouse
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-12-
|
12
|
+
date: 2023-12-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_api_client
|
@@ -211,6 +211,7 @@ files:
|
|
211
211
|
- lib/dina/utils/multi_lingual_title.rb
|
212
212
|
- lib/dina/utils/validator.rb
|
213
213
|
- lib/dina/version.rb
|
214
|
+
- lib/rest_client_request_patch.rb
|
214
215
|
homepage: https://github.com/dshorthouse/dina
|
215
216
|
licenses:
|
216
217
|
- MIT
|