swiftype 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 13981a414b87f3820b0561ce55e22014311c1766
4
- data.tar.gz: 1f68d66bba5aea0b1d5beeed4a253deabd942502
2
+ SHA256:
3
+ metadata.gz: add2978c79c2494fc993252665bc65af92383ad5a00dc8e86eaae70114059aac
4
+ data.tar.gz: 5b03ebc6b72eca5793c0264c03db5b18150cc6de88daeabebb6d95fbc352c463
5
5
  SHA512:
6
- metadata.gz: ec53f7d6df041432268ca9061bb3a49aab3a170a23b43f2d9c4bd0b2e1ea75cf1eac8b13e6d7ecc8de8195a7c4fd3860e206c2c7a28f9766f152ebb0c571fb04
7
- data.tar.gz: 1ca58366f50297910aeb7f3086f31c4c561db38ec4c820dd30abcad36eb98e4c8260d16ccd785880c9f4d5a3b46e6f67844e62b2c975938110bdbcea91eb441f
6
+ metadata.gz: 4b5db4bfafb4975ed03ae34ebcdd86ce13aa8e5ccad65260608626dab59e4a61de4a56fda4731472289a758e0cf2d0a286f496ab90baa4a2841a9e1e9b04634f
7
+ data.tar.gz: b6d111e80d985366e60ed382d37183bd1fa72dd5fed5e8661f04ef4ef6d9f255cc6ebe121f2e1a96c10fa2532e27126effc4f5969579d841f0fe2e90ef507867
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
- # Swiftype Ruby API Client
1
+ # Ruby Client for Swiftype Site Search API
2
2
 
3
3
  [![Build Status](https://travis-ci.org/swiftype/swiftype-rb.png)](https://travis-ci.org/swiftype/swiftype-rb)
4
4
 
5
- This is a simple client for the [Swiftype API](https://swiftype.com/documentation/overview) with no dependencies outside core Ruby (for 1.9 and 2.0; Ruby 1.8 requires the JSON gem).
5
+ This is a simple client for the [Swiftype Site Search API](https://swiftype.com/documentation/site-search/overview) with no dependencies outside core Ruby (for 1.9 and 2.0; Ruby 1.8 requires the JSON gem).
6
+
7
+ > **Note:** This client has been developed for the [Swiftype Site Search](https://www.swiftype.com/site-search) API endpoints only.
6
8
 
7
9
  ## Getting Started
8
10
 
@@ -10,7 +12,7 @@ Before beginning with the Swiftype gem, you should be familar with the concepts
10
12
 
11
13
  An **Engine** is a search engine. It can contain one or more **DocumentTypes** which are collections of **Documents**. A **Document** is a collection of fields that can be queried using the Swiftype API. Documents have a special **external_id** field that ties a Document in Swiftype to a record in your system. The layout of fields of the Documents belonging to a DocumentType is called a **schema**. Fields may be strings, integers, geographic locations, and so forth.
12
14
 
13
- The Documents in your Engine can be searched two ways: **full-text** (`search`) or **autocomplete** (`suggest`). The difference is that autocomplete queries work on prefixes (for example, "gla" will match "glass"). This is less accurage in general, but is useful for implementing type-ahead search drop downs.
15
+ The Documents in your Engine can be searched two ways: **full-text** (`search`) or **autocomplete** (`suggest`). The difference is that autocomplete queries work on prefixes (for example, "gla" will match "glass"). This is less accurate in general, but is useful for implementing type-ahead search drop downs.
14
16
 
15
17
  You can think of an Engine as a database, DocumentTypes as tables, and Documents as rows. Using the API, you can search an engine for all Documents containing a word. You can also search an individual DocumentType, or any subset of DocumentTypes.
16
18
 
@@ -327,7 +329,7 @@ To get the number of searches per day from an Engine in the last 14 days:
327
329
 
328
330
  You can also use a specific start and/or end date:
329
331
 
330
- searches = client.analytics_searches('swiftype-api-example', '2013-01-01', '2013-01-07')
332
+ searches = client.analytics_searches('swiftype-api-example', {:start_date => '2013-01-01', :end_date => '2013-01-07'})
331
333
 
332
334
  To get the number of autoselects in the past 14 days:
333
335
 
@@ -335,7 +337,7 @@ To get the number of autoselects in the past 14 days:
335
337
 
336
338
  As with searches you can also limit by start and/or end date:
337
339
 
338
- autoselects = client.analytics_autoselects('swiftype-api-example', '2013-01-01', '2013-01-07')
340
+ autoselects = client.analytics_autoselects('swiftype-api-example', {:start_date => '2013-01-01', :end_date => '2013-01-07'})
339
341
 
340
342
  If you are interested in the top queries for your Engine you can use:
341
343
 
@@ -43,6 +43,9 @@ module Swiftype
43
43
  (@options[:overall_timeout] || DEFAULT_TIMEOUT).to_f
44
44
  end
45
45
 
46
+ def wrap(element)
47
+ [element].flatten(1)
48
+ end
46
49
 
47
50
  # Methods wrapping the Swiftype private search and API endpoints. Using these methods, you can perform full-text
48
51
  # and prefix searches over the Documents in your Engine, in a specific DocumentType, or any subset of DocumentTypes.
@@ -356,7 +359,7 @@ module Swiftype
356
359
  #
357
360
  # @raise [Timeout::Error] when used in :async => false mode and the timeout expires
358
361
  def index_documents(engine_id, document_type_id, documents = [], options = {})
359
- documents = Array(documents)
362
+ documents = wrap(documents)
360
363
 
361
364
  res = async_create_or_update_documents(engine_id, document_type_id, documents)
362
365
 
@@ -63,7 +63,10 @@ module Swiftype
63
63
 
64
64
  if uri.scheme == 'https'
65
65
  http.use_ssl = true
66
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
66
+ # st_ssl_verify_none provides a means to disable SSL verification for debugging purposes. An example
67
+ # is Charles, which uses a self-signed certificate in order to inspect https traffic. This will
68
+ # not be part of this client's public API, this is more of a development enablement option
69
+ http.verify_mode = ENV['st_ssl_verify_none'] == 'true' ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER
67
70
  http.ca_file = File.join(File.dirname(__FILE__), '..', 'data', 'ca-bundle.crt')
68
71
  http.ssl_timeout = open_timeout
69
72
  end
@@ -1,3 +1,3 @@
1
1
  module Swiftype
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
@@ -12,12 +12,13 @@ RSpec.configure do |config|
12
12
  config.order = "random"
13
13
 
14
14
  VCR.configure do |c|
15
+ c.default_cassette_options = { :record => :once, :match_requests_on => [:host, :path, :method] }
15
16
  c.cassette_library_dir = 'spec/fixtures/vcr'
16
17
  c.hook_into :webmock
17
18
  end
18
19
 
19
20
  config.before :each do
20
- Swiftype.endpoint = "http://localhost:3000/api/v1/"
21
+ Swiftype.endpoint = "http://hello:@localhost:3000/api/v1/"
21
22
  end
22
23
 
23
24
  config.after :each do
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.add_development_dependency 'rspec', '~> 3.0.0'
19
19
  s.add_development_dependency 'awesome_print'
20
- s.add_development_dependency 'vcr', '~> 2.9.0'
20
+ s.add_development_dependency 'vcr', '~> 4.0.0'
21
21
  s.add_development_dependency 'webmock'
22
22
  if RUBY_VERSION < '1.9'
23
23
  s.add_runtime_dependency 'json'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swiftype
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Quin Hoxie
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-20 00:00:00.000000000 Z
12
+ date: 2018-09-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 2.9.0
48
+ version: 4.0.0
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 2.9.0
55
+ version: 4.0.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: webmock
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.4.5
194
+ rubygems_version: 2.7.6
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Official gem for accessing the Swiftype Search API