Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Merge pull request #25 from swiftype/jasonstoltz/fixes-17
Browse files Browse the repository at this point in the history
Fixes #17
  • Loading branch information
JasonStoltz authored Sep 24, 2018
2 parents bb7ca7f + 27d8f57 commit 9ca34f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/swiftype/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion lib/swiftype/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9ca34f0

Please sign in to comment.