From 1539510f40985681fe132e26b477ce710ee826ec Mon Sep 17 00:00:00 2001 From: Jason Stoltzfus Date: Mon, 24 Sep 2018 10:55:53 -0400 Subject: [PATCH 1/2] Fixes #17 - Index single document 500 Changed the way we wrap a single document in an Array. --- lib/swiftype/client.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/swiftype/client.rb b/lib/swiftype/client.rb index 61ecfad..2e095b5 100644 --- a/lib/swiftype/client.rb +++ b/lib/swiftype/client.rb @@ -43,6 +43,9 @@ def overall_timeout (@options[:overall_timeout] || DEFAULT_TIMEOUT).to_f end + def wrap(element) + [element].flatten(1) + end # Methods wrapping the Swiftype private search and API endpoints. Using these methods, you can perform full-text # and prefix searches over the Documents in your Engine, in a specific DocumentType, or any subset of DocumentTypes. @@ -356,7 +359,7 @@ def document_receipts(receipt_ids) # # @raise [Timeout::Error] when used in :async => false mode and the timeout expires def index_documents(engine_id, document_type_id, documents = [], options = {}) - documents = Array(documents) + documents = wrap(documents) res = async_create_or_update_documents(engine_id, document_type_id, documents) From 27d8f573f0c0d9f0c42058af54ceda70b38e2236 Mon Sep 17 00:00:00 2001 From: Jason Stoltzfus Date: Mon, 24 Sep 2018 10:57:15 -0400 Subject: [PATCH 2/2] Added `st_ssl_verify_none` for debugging `st_ssl_verify_none` is used to enable the use of debugging with tools like Charles, which use a self signed certificate. --- lib/swiftype/request.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/swiftype/request.rb b/lib/swiftype/request.rb index e6e9559..f1965f3 100644 --- a/lib/swiftype/request.rb +++ b/lib/swiftype/request.rb @@ -63,7 +63,10 @@ def request(method, path, params={}) if uri.scheme == 'https' http.use_ssl = true - http.verify_mode = OpenSSL::SSL::VERIFY_PEER + # st_ssl_verify_none provides a means to disable SSL verification for debugging purposes. An example + # is Charles, which uses a self-signed certificate in order to inspect https traffic. This will + # not be part of this client's public API, this is more of a development enablement option + http.verify_mode = ENV['st_ssl_verify_none'] == 'true' ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER http.ca_file = File.join(File.dirname(__FILE__), '..', 'data', 'ca-bundle.crt') http.ssl_timeout = open_timeout end