swiftype-enterprise 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Configuration' do
4
+ context '.endpoint' do
5
+ context 'with a trailing /' do
6
+ it 'adds / to the end of of the URL' do
7
+ SwiftypeEnterprise.endpoint = 'https://api.swiftype.com/api/v1'
8
+ expect(SwiftypeEnterprise.endpoint).to eq('https://api.swiftype.com/api/v1/')
9
+ end
10
+ end
11
+
12
+ context 'with a trailing /' do
13
+ it 'leaves the URL alone' do
14
+ SwiftypeEnterprise.endpoint = 'https://api.swiftype.com/api/v1/'
15
+ expect(SwiftypeEnterprise.endpoint).to eq('https://api.swiftype.com/api/v1/')
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,203 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://localhost:3002/api/v1/ent/sources/59542d332139de0acacc7dd4/documents/bulk_create.json
6
+ body:
7
+ encoding: UTF-8
8
+ string: '[{"external_id":"INscMGmhmX4","url":"http://www.youtube.com/watch?v=v1uyQZNg2vE","title":"The
9
+ Original Grumpy Cat","body":"this is a test\na_new_field: some value"},{"external_id":"JNDFojsd02","url":"http://www.youtube.com/watch?v=tsdfhk2j","title":"Another
10
+ Grumpy Cat","body":"this is also a test"}]'
11
+ headers:
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ User-Agent:
17
+ - SwiftypeEnterprise-Ruby/1.0.0
18
+ Content-Type:
19
+ - application/json
20
+ Authorization:
21
+ - Bearer cGUN-vBokevBhhzyA669
22
+ response:
23
+ status:
24
+ code: 202
25
+ message: Accepted
26
+ headers:
27
+ X-Frame-Options:
28
+ - SAMEORIGIN
29
+ X-Xss-Protection:
30
+ - 1; mode=block
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Cache-Control:
36
+ - no-cache
37
+ Set-Cookie:
38
+ - _st_main_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFVEkiJTczZTBhZmUyNGMyMDJiMTAzMWNjZDlkMDY3ODQ2YzcyBjsAVA%3D%3D--c82c5b797014cbda84cdf73408fe2af71a00986c;
39
+ path=/; expires=Wed, 30 Jun 2027 00:36:47 -0000; HttpOnly
40
+ X-Request-Id:
41
+ - 7add3a71-5e8a-4a37-bacc-58b2114be10e
42
+ X-Runtime:
43
+ - '1.914340'
44
+ Connection:
45
+ - close
46
+ Server:
47
+ - thin 1.5.0 codename Knife
48
+ body:
49
+ encoding: UTF-8
50
+ string: '{"batch_link":"http://localhost:3002/api/v1/ent/document_receipts/bulk_show?ids=59559d1d2139deb77b971ae4%2C59559d1e2139deb77b971ae6","document_receipts":[{"id":"59559d1d2139deb77b971ae4","external_id":"INscMGmhmX4","status":"pending","errors":[],"links":{"document_receipt":"http://localhost:3002/api/v1/ent/document_receipts/59559d1d2139deb77b971ae4"}},{"id":"59559d1e2139deb77b971ae6","external_id":"JNDFojsd02","status":"pending","errors":[],"links":{"document_receipt":"http://localhost:3002/api/v1/ent/document_receipts/59559d1e2139deb77b971ae6"}}]}'
51
+ http_version:
52
+ recorded_at: Fri, 30 Jun 2017 00:36:47 GMT
53
+ - request:
54
+ method: get
55
+ uri: http://localhost:3002/api/v1/ent/document_receipts/bulk_show.json?ids=59559d1d2139deb77b971ae4,59559d1e2139deb77b971ae6
56
+ body:
57
+ encoding: US-ASCII
58
+ string: ''
59
+ headers:
60
+ Accept-Encoding:
61
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
62
+ Accept:
63
+ - "*/*"
64
+ User-Agent:
65
+ - SwiftypeEnterprise-Ruby/1.0.0
66
+ Content-Type:
67
+ - application/json
68
+ Authorization:
69
+ - Bearer cGUN-vBokevBhhzyA669
70
+ response:
71
+ status:
72
+ code: 200
73
+ message: OK
74
+ headers:
75
+ X-Frame-Options:
76
+ - SAMEORIGIN
77
+ X-Xss-Protection:
78
+ - 1; mode=block
79
+ X-Content-Type-Options:
80
+ - nosniff
81
+ Content-Type:
82
+ - application/json; charset=utf-8
83
+ Etag:
84
+ - W/"7321cee676f2037c66fe3bf9884e86c4"
85
+ Cache-Control:
86
+ - max-age=0, private, must-revalidate
87
+ Set-Cookie:
88
+ - _st_main_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFVEkiJTliNzgwMDljYWI1M2Q3YWRkYjllODFlNjBmMzcxMjYwBjsAVA%3D%3D--2a39e8d4f88d3c0b6d1107052368c36dc7802bf5;
89
+ path=/; expires=Wed, 30 Jun 2027 00:36:47 -0000; HttpOnly
90
+ X-Request-Id:
91
+ - 74cee7e8-4169-4098-bb78-11d482424410
92
+ X-Runtime:
93
+ - '0.502529'
94
+ Connection:
95
+ - close
96
+ Server:
97
+ - thin 1.5.0 codename Knife
98
+ body:
99
+ encoding: UTF-8
100
+ string: '[{"id":"59559d1d2139deb77b971ae4","external_id":"INscMGmhmX4","status":"pending","errors":[],"links":{"document_receipt":"http://localhost:3002/api/v1/ent/document_receipts/59559d1d2139deb77b971ae4"}},{"id":"59559d1e2139deb77b971ae6","external_id":"JNDFojsd02","status":"pending","errors":[],"links":{"document_receipt":"http://localhost:3002/api/v1/ent/document_receipts/59559d1e2139deb77b971ae6"}}]'
101
+ http_version:
102
+ recorded_at: Fri, 30 Jun 2017 00:36:47 GMT
103
+ - request:
104
+ method: get
105
+ uri: http://localhost:3002/api/v1/ent/document_receipts/bulk_show.json?ids=59559d1d2139deb77b971ae4,59559d1e2139deb77b971ae6
106
+ body:
107
+ encoding: US-ASCII
108
+ string: ''
109
+ headers:
110
+ Accept-Encoding:
111
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
112
+ Accept:
113
+ - "*/*"
114
+ User-Agent:
115
+ - SwiftypeEnterprise-Ruby/1.0.0
116
+ Content-Type:
117
+ - application/json
118
+ Authorization:
119
+ - Bearer cGUN-vBokevBhhzyA669
120
+ response:
121
+ status:
122
+ code: 200
123
+ message: OK
124
+ headers:
125
+ X-Frame-Options:
126
+ - SAMEORIGIN
127
+ X-Xss-Protection:
128
+ - 1; mode=block
129
+ X-Content-Type-Options:
130
+ - nosniff
131
+ Content-Type:
132
+ - application/json; charset=utf-8
133
+ Etag:
134
+ - W/"7321cee676f2037c66fe3bf9884e86c4"
135
+ Cache-Control:
136
+ - max-age=0, private, must-revalidate
137
+ Set-Cookie:
138
+ - _st_main_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFVEkiJTZiYzk5ZGY0NjBjM2MwOTE2NTQ4NGNhM2FmNzBlNDI5BjsAVA%3D%3D--8391c3c5b2cf7a473214fa42e67cb59a25153031;
139
+ path=/; expires=Wed, 30 Jun 2027 00:36:48 -0000; HttpOnly
140
+ X-Request-Id:
141
+ - 9fe65c9a-fcb6-40c9-baf6-e9575a37018d
142
+ X-Runtime:
143
+ - '0.335490'
144
+ Connection:
145
+ - close
146
+ Server:
147
+ - thin 1.5.0 codename Knife
148
+ body:
149
+ encoding: UTF-8
150
+ string: '[{"id":"59559d1d2139deb77b971ae4","external_id":"INscMGmhmX4","status":"pending","errors":[],"links":{"document_receipt":"http://localhost:3002/api/v1/ent/document_receipts/59559d1d2139deb77b971ae4"}},{"id":"59559d1e2139deb77b971ae6","external_id":"JNDFojsd02","status":"pending","errors":[],"links":{"document_receipt":"http://localhost:3002/api/v1/ent/document_receipts/59559d1e2139deb77b971ae6"}}]'
151
+ http_version:
152
+ recorded_at: Fri, 30 Jun 2017 00:36:48 GMT
153
+ - request:
154
+ method: get
155
+ uri: http://localhost:3002/api/v1/ent/document_receipts/bulk_show.json?ids=59559d1d2139deb77b971ae4,59559d1e2139deb77b971ae6
156
+ body:
157
+ encoding: US-ASCII
158
+ string: ''
159
+ headers:
160
+ Accept-Encoding:
161
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
162
+ Accept:
163
+ - "*/*"
164
+ User-Agent:
165
+ - SwiftypeEnterprise-Ruby/1.0.0
166
+ Content-Type:
167
+ - application/json
168
+ Authorization:
169
+ - Bearer cGUN-vBokevBhhzyA669
170
+ response:
171
+ status:
172
+ code: 200
173
+ message: OK
174
+ headers:
175
+ X-Frame-Options:
176
+ - SAMEORIGIN
177
+ X-Xss-Protection:
178
+ - 1; mode=block
179
+ X-Content-Type-Options:
180
+ - nosniff
181
+ Content-Type:
182
+ - application/json; charset=utf-8
183
+ Etag:
184
+ - W/"8af6b8fc44aabca14d763242c1d761f3"
185
+ Cache-Control:
186
+ - max-age=0, private, must-revalidate
187
+ Set-Cookie:
188
+ - _st_main_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFVEkiJTc0Mjg1MWMwZGQxM2Y1M2FhNTA4ZmEzMWU0NGU5NzE1BjsAVA%3D%3D--c2e04b8db85eb7514c9549fa89fd2b5f09e3a633;
189
+ path=/; expires=Wed, 30 Jun 2027 00:36:48 -0000; HttpOnly
190
+ X-Request-Id:
191
+ - 78869040-e727-4f5a-83b8-57266242c7ba
192
+ X-Runtime:
193
+ - '0.386772'
194
+ Connection:
195
+ - close
196
+ Server:
197
+ - thin 1.5.0 codename Knife
198
+ body:
199
+ encoding: UTF-8
200
+ string: '[{"id":"59559d1d2139deb77b971ae4","external_id":"INscMGmhmX4","status":"complete","errors":[],"links":{"document_receipt":"http://localhost:3002/api/v1/ent/document_receipts/59559d1d2139deb77b971ae4"}},{"id":"59559d1e2139deb77b971ae6","external_id":"JNDFojsd02","status":"complete","errors":[],"links":{"document_receipt":"http://localhost:3002/api/v1/ent/document_receipts/59559d1e2139deb77b971ae6"}}]'
201
+ http_version:
202
+ recorded_at: Fri, 30 Jun 2017 00:36:48 GMT
203
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,28 @@
1
+ require 'bundler/setup'
2
+ require 'rspec'
3
+ require 'webmock'
4
+ require 'vcr'
5
+ require 'awesome_print'
6
+ require 'swiftype-enterprise'
7
+
8
+
9
+ RSpec.configure do |config|
10
+ # Run specs in random order to surface order dependencies. If you find an
11
+ # order dependency and want to debug it, you can fix the order by providing
12
+ # the seed, which is printed after each run.
13
+ # --seed 1234
14
+ config.order = "random"
15
+
16
+ VCR.configure do |c|
17
+ c.cassette_library_dir = 'spec/fixtures/vcr'
18
+ c.hook_into :webmock
19
+ end
20
+
21
+ config.before :each do
22
+ SwiftypeEnterprise.endpoint = ENV["ENDPOINT"]
23
+ end
24
+
25
+ config.after :each do
26
+ SwiftypeEnterprise.reset
27
+ end
28
+ end
@@ -0,0 +1,22 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "swiftype-enterprise/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "swiftype-enterprise"
6
+ s.version = SwiftypeEnterprise::VERSION
7
+ s.authors = ["Quin Hoxie"]
8
+ s.email = ["support@swiftype.com"]
9
+ s.homepage = "https://swiftype.com"
10
+ s.summary = %q{Official gem for accessing the Swiftype Enterprise API}
11
+ s.description = %q{API client for accessing the Swiftype Enterprise API with no dependencies.}
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ s.require_paths = ["lib"]
17
+
18
+ s.add_development_dependency 'rspec', '~> 3.0.0'
19
+ s.add_development_dependency 'awesome_print'
20
+ s.add_development_dependency 'vcr', '~> 3.0.3'
21
+ s.add_development_dependency 'webmock'
22
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: swiftype-enterprise
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Quin Hoxie
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-07-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: awesome_print
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: vcr
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.0.3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: API client for accessing the Swiftype Enterprise API with no dependencies.
70
+ email:
71
+ - support@swiftype.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - lib/data/ca-bundle.crt
83
+ - lib/swiftype-enterprise.rb
84
+ - lib/swiftype-enterprise/client.rb
85
+ - lib/swiftype-enterprise/configuration.rb
86
+ - lib/swiftype-enterprise/exceptions.rb
87
+ - lib/swiftype-enterprise/request.rb
88
+ - lib/swiftype-enterprise/utils.rb
89
+ - lib/swiftype-enterprise/version.rb
90
+ - spec/client_spec.rb
91
+ - spec/configuration_spec.rb
92
+ - spec/fixtures/vcr/document_receipts_multiple_complete.yml
93
+ - spec/spec_helper.rb
94
+ - swiftype-enterprise.gemspec
95
+ homepage: https://swiftype.com
96
+ licenses: []
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.4.5
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: Official gem for accessing the Swiftype Enterprise API
118
+ test_files:
119
+ - spec/client_spec.rb
120
+ - spec/configuration_spec.rb
121
+ - spec/fixtures/vcr/document_receipts_multiple_complete.yml
122
+ - spec/spec_helper.rb