swiftype-app-search 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +56 -0
- data/README.md +2 -0
- data/lib/swiftype-app-search/request.rb +4 -2
- data/lib/swiftype-app-search/version.rb +1 -1
- data/spec/client_spec.rb +15 -0
- data/spec/spec_helper.rb +3 -1
- 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: 7ed5f865b5826a9e1f6ef4159e8666f40854d88507d5e385ade79843be1ec328
|
4
|
+
data.tar.gz: 8de8289db41e4b425c88890c7e9ec9d2347b6f234654c0813d9f79b51c40601c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fd5aafef38257cae51fc924825020cceb127c980d54c26e6011ee28a3b620d8143fa94e56d49de5fd9e646e3509f2242afbc425da220a013e040d6f6e2aa3f8
|
7
|
+
data.tar.gz: d78bda22152a9e4046582612c136a63bdd3a18daa0d1a305a847ac04a4f90b077a9805f17f7c638807fba3dd58702143b861fe29158a2032ec6a7c5cadc2c3da
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
# specify the version you desire here
|
10
|
+
- image: circleci/ruby:2.4.1-node-browsers
|
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
|
16
|
+
|
17
|
+
working_directory: ~/repo
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- checkout
|
21
|
+
|
22
|
+
# Download and cache dependencies
|
23
|
+
- restore_cache:
|
24
|
+
keys:
|
25
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
26
|
+
# fallback to using the latest cache if no exact match is found
|
27
|
+
- v1-dependencies-
|
28
|
+
|
29
|
+
- run:
|
30
|
+
name: install dependencies
|
31
|
+
command: |
|
32
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
33
|
+
|
34
|
+
- save_cache:
|
35
|
+
paths:
|
36
|
+
- ./vendor/bundle
|
37
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
38
|
+
|
39
|
+
# run tests!
|
40
|
+
- run:
|
41
|
+
name: run tests
|
42
|
+
command: |
|
43
|
+
mkdir /tmp/test-results
|
44
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
45
|
+
|
46
|
+
bundle exec rspec --format progress \
|
47
|
+
--out /tmp/test-results/rspec.xml \
|
48
|
+
--format progress \
|
49
|
+
$TEST_FILES
|
50
|
+
|
51
|
+
# collect reports
|
52
|
+
- store_test_results:
|
53
|
+
path: /tmp/test-results
|
54
|
+
- store_artifacts:
|
55
|
+
path: /tmp/test-results
|
56
|
+
destination: test-results
|
data/README.md
CHANGED
@@ -6,7 +6,8 @@ require 'swiftype-app-search/version'
|
|
6
6
|
require 'openssl'
|
7
7
|
|
8
8
|
module SwiftypeAppSearch
|
9
|
-
|
9
|
+
CLIENT_NAME = 'swiftype-app-search-ruby'
|
10
|
+
CLIENT_VERSION = SwiftypeAppSearch::VERSION
|
10
11
|
|
11
12
|
module Request
|
12
13
|
attr_accessor :last_request
|
@@ -133,7 +134,8 @@ module SwiftypeAppSearch
|
|
133
134
|
req = klass.new(uri.request_uri)
|
134
135
|
req.body = serialize_json(params) unless params.length == 0
|
135
136
|
|
136
|
-
req['
|
137
|
+
req['X-Swiftype-Client'] = CLIENT_NAME
|
138
|
+
req['X-Swiftype-Client-Version'] = CLIENT_VERSION
|
137
139
|
req['Content-Type'] = 'application/json'
|
138
140
|
req['Authorization'] = "Bearer #{api_key}"
|
139
141
|
|
data/spec/client_spec.rb
CHANGED
@@ -1,9 +1,24 @@
|
|
1
|
+
|
1
2
|
describe SwiftypeAppSearch::Client do
|
2
3
|
let(:engine_name) { "ruby-client-test-#{Time.now.to_i}" }
|
3
4
|
|
4
5
|
include_context "App Search Credentials"
|
5
6
|
let(:client) { SwiftypeAppSearch::Client.new(client_options) }
|
6
7
|
|
8
|
+
describe 'Requests' do
|
9
|
+
it 'should include client name and version in headers' do
|
10
|
+
stub_request(:any, "#{client_options[:host_identifier]}.api.swiftype.com/api/as/v1/engines")
|
11
|
+
client.list_engines
|
12
|
+
expect(WebMock).to have_requested(:get, "https://#{client_options[:host_identifier]}.api.swiftype.com/api/as/v1/engines").
|
13
|
+
with(
|
14
|
+
headers: {
|
15
|
+
'X-Swiftype-Client' => 'swiftype-app-search-ruby',
|
16
|
+
'X-Swiftype-Client-Version' => SwiftypeAppSearch::VERSION
|
17
|
+
}
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
7
22
|
context 'Documents' do
|
8
23
|
let(:document) { { 'url' => 'http://www.youtube.com/watch?v=v1uyQZNg2vE' } }
|
9
24
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
require 'rspec'
|
3
|
-
require 'webmock'
|
3
|
+
require 'webmock/rspec'
|
4
4
|
require 'awesome_print'
|
5
5
|
require 'swiftype-app-search'
|
6
6
|
|
7
|
+
WebMock.allow_net_connect!
|
8
|
+
|
7
9
|
RSpec.shared_context "App Search Credentials" do
|
8
10
|
let(:as_api_key) { ENV.fetch('AS_API_KEY', 'API_KEY') }
|
9
11
|
# AS_ACCOUNT_HOST_KEY is deprecated
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swiftype-app-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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: 2018-
|
11
|
+
date: 2018-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -87,6 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".circleci/config.yml"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".rspec"
|
92
93
|
- ".travis.yml"
|