dock_genius_api_ruby_client 0.1.1.pre.g582ac6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/README.md +200 -0
  4. data/dock_genius_api_ruby_client.gemspec +55 -0
  5. data/docs/AccessToken.md +11 -0
  6. data/docs/Address.md +16 -0
  7. data/docs/Customer.md +22 -0
  8. data/docs/CustomerApi.md +1938 -0
  9. data/docs/Dock.md +20 -0
  10. data/docs/DockApi.md +1112 -0
  11. data/docs/EmailAddress.md +9 -0
  12. data/docs/GeoPoint.md +9 -0
  13. data/docs/InlineResponse200.md +8 -0
  14. data/docs/InlineResponse2001.md +8 -0
  15. data/docs/InlineResponse2002.md +8 -0
  16. data/docs/ListingAgent.md +12 -0
  17. data/docs/Marina.md +15 -0
  18. data/docs/MarinaApi.md +1602 -0
  19. data/docs/Phone.md +9 -0
  20. data/git_push.sh +67 -0
  21. data/lib/dock_genius_api_ruby_client/api/customer_api.rb +2363 -0
  22. data/lib/dock_genius_api_ruby_client/api/dock_api.rb +1352 -0
  23. data/lib/dock_genius_api_ruby_client/api/marina_api.rb +1945 -0
  24. data/lib/dock_genius_api_ruby_client/api_client.rb +378 -0
  25. data/lib/dock_genius_api_ruby_client/api_error.rb +47 -0
  26. data/lib/dock_genius_api_ruby_client/configuration.rb +207 -0
  27. data/lib/dock_genius_api_ruby_client/models/access_token.rb +230 -0
  28. data/lib/dock_genius_api_ruby_client/models/address.rb +281 -0
  29. data/lib/dock_genius_api_ruby_client/models/customer.rb +330 -0
  30. data/lib/dock_genius_api_ruby_client/models/dock.rb +327 -0
  31. data/lib/dock_genius_api_ruby_client/models/email_address.rb +208 -0
  32. data/lib/dock_genius_api_ruby_client/models/geo_point.rb +208 -0
  33. data/lib/dock_genius_api_ruby_client/models/inline_response_200.rb +199 -0
  34. data/lib/dock_genius_api_ruby_client/models/inline_response_200_1.rb +200 -0
  35. data/lib/dock_genius_api_ruby_client/models/inline_response_200_2.rb +199 -0
  36. data/lib/dock_genius_api_ruby_client/models/listing_agent.rb +239 -0
  37. data/lib/dock_genius_api_ruby_client/models/marina.rb +263 -0
  38. data/lib/dock_genius_api_ruby_client/models/phone.rb +209 -0
  39. data/lib/dock_genius_api_ruby_client/version.rb +26 -0
  40. data/lib/dock_genius_api_ruby_client.rb +65 -0
  41. data/spec/api/customer_api_spec.rb +551 -0
  42. data/spec/api/dock_api_spec.rb +332 -0
  43. data/spec/api/marina_api_spec.rb +461 -0
  44. data/spec/api_client_spec.rb +237 -0
  45. data/spec/configuration_spec.rb +53 -0
  46. data/spec/models/access_token_spec.rb +71 -0
  47. data/spec/models/address_spec.rb +101 -0
  48. data/spec/models/customer_spec.rb +137 -0
  49. data/spec/models/dock_spec.rb +125 -0
  50. data/spec/models/email_address_spec.rb +59 -0
  51. data/spec/models/geo_point_spec.rb +59 -0
  52. data/spec/models/inline_response_200_1_spec.rb +53 -0
  53. data/spec/models/inline_response_200_2_spec.rb +53 -0
  54. data/spec/models/inline_response_200_spec.rb +53 -0
  55. data/spec/models/listing_agent_spec.rb +77 -0
  56. data/spec/models/marina_spec.rb +95 -0
  57. data/spec/models/phone_spec.rb +59 -0
  58. data/spec/spec_helper.rb +122 -0
  59. metadata +299 -0
@@ -0,0 +1,461 @@
1
+ =begin
2
+ #dockgenius-sl
3
+
4
+ #No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 0.1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'spec_helper'
25
+ require 'json'
26
+
27
+ # Unit tests for DockGeniusApiRubyClient::MarinaApi
28
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
29
+ # Please update as you see appropriate
30
+ describe 'MarinaApi' do
31
+ before do
32
+ # run before each test
33
+ @instance = DockGeniusApiRubyClient::MarinaApi.new
34
+ end
35
+
36
+ after do
37
+ # run after each test
38
+ end
39
+
40
+ describe 'test an instance of MarinaApi' do
41
+ it 'should create an instact of MarinaApi' do
42
+ expect(@instance).to be_instance_of(DockGeniusApiRubyClient::MarinaApi)
43
+ end
44
+ end
45
+
46
+ # unit tests for marina_count
47
+ # Count instances of the model matched by where from the data source.
48
+ #
49
+ # @param [Hash] opts the optional parameters
50
+ # @option opts [String] :where Criteria to match model instances
51
+ # @return [InlineResponse200]
52
+ describe 'marina_count test' do
53
+ it "should work" do
54
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
55
+ end
56
+ end
57
+
58
+ # unit tests for marina_create
59
+ # Create a new instance of the model and persist it into the data source.
60
+ #
61
+ # @param [Hash] opts the optional parameters
62
+ # @option opts [Marina] :data Model instance data
63
+ # @return [Marina]
64
+ describe 'marina_create test' do
65
+ it "should work" do
66
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
67
+ end
68
+ end
69
+
70
+ # unit tests for marina_create_change_stream_get_marinas_change_stream
71
+ # Create a change stream.
72
+ #
73
+ # @param [Hash] opts the optional parameters
74
+ # @option opts [String] :options
75
+ # @return [File]
76
+ describe 'marina_create_change_stream_get_marinas_change_stream test' do
77
+ it "should work" do
78
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
79
+ end
80
+ end
81
+
82
+ # unit tests for marina_create_change_stream_post_marinas_change_stream
83
+ # Create a change stream.
84
+ #
85
+ # @param [Hash] opts the optional parameters
86
+ # @option opts [String] :options
87
+ # @return [File]
88
+ describe 'marina_create_change_stream_post_marinas_change_stream test' do
89
+ it "should work" do
90
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
91
+ end
92
+ end
93
+
94
+ # unit tests for marina_delete_by_id
95
+ # Delete a model instance by {{id}} from the data source.
96
+ #
97
+ # @param id Model id
98
+ # @param [Hash] opts the optional parameters
99
+ # @return [Object]
100
+ describe 'marina_delete_by_id test' do
101
+ it "should work" do
102
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
103
+ end
104
+ end
105
+
106
+ # unit tests for marina_exists_get_marinasid_exists
107
+ # Check whether a model instance exists in the data source.
108
+ #
109
+ # @param id Model id
110
+ # @param [Hash] opts the optional parameters
111
+ # @return [InlineResponse2002]
112
+ describe 'marina_exists_get_marinasid_exists test' do
113
+ it "should work" do
114
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
115
+ end
116
+ end
117
+
118
+ # unit tests for marina_exists_head_marinasid
119
+ # Check whether a model instance exists in the data source.
120
+ #
121
+ # @param id Model id
122
+ # @param [Hash] opts the optional parameters
123
+ # @return [InlineResponse2002]
124
+ describe 'marina_exists_head_marinasid test' do
125
+ it "should work" do
126
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
127
+ end
128
+ end
129
+
130
+ # unit tests for marina_find
131
+ # Find all instances of the model matched by filter from the data source.
132
+ #
133
+ # @param [Hash] opts the optional parameters
134
+ # @option opts [String] :filter Filter defining fields, where, include, order, offset, and limit
135
+ # @return [Array<Marina>]
136
+ describe 'marina_find test' do
137
+ it "should work" do
138
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
139
+ end
140
+ end
141
+
142
+ # unit tests for marina_find_by_id
143
+ # Find a model instance by {{id}} from the data source.
144
+ #
145
+ # @param id Model id
146
+ # @param [Hash] opts the optional parameters
147
+ # @option opts [String] :filter Filter defining fields and include
148
+ # @return [Marina]
149
+ describe 'marina_find_by_id test' do
150
+ it "should work" do
151
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
152
+ end
153
+ end
154
+
155
+ # unit tests for marina_find_one
156
+ # Find first instance of the model matched by filter from the data source.
157
+ #
158
+ # @param [Hash] opts the optional parameters
159
+ # @option opts [String] :filter Filter defining fields, where, include, order, offset, and limit
160
+ # @return [Marina]
161
+ describe 'marina_find_one test' do
162
+ it "should work" do
163
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
164
+ end
165
+ end
166
+
167
+ # unit tests for marina_prototype_count_docks
168
+ # Counts docks of Marina.
169
+ #
170
+ # @param id PersistedModel id
171
+ # @param [Hash] opts the optional parameters
172
+ # @option opts [String] :where Criteria to match model instances
173
+ # @return [InlineResponse200]
174
+ describe 'marina_prototype_count_docks test' do
175
+ it "should work" do
176
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
177
+ end
178
+ end
179
+
180
+ # unit tests for marina_prototype_create_address
181
+ # Creates a new instance in address of this model.
182
+ #
183
+ # @param id PersistedModel id
184
+ # @param [Hash] opts the optional parameters
185
+ # @option opts [Address] :data
186
+ # @return [Address]
187
+ describe 'marina_prototype_create_address test' do
188
+ it "should work" do
189
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
190
+ end
191
+ end
192
+
193
+ # unit tests for marina_prototype_create_docks
194
+ # Creates a new instance in docks of this model.
195
+ #
196
+ # @param id PersistedModel id
197
+ # @param [Hash] opts the optional parameters
198
+ # @option opts [Dock] :data
199
+ # @return [Dock]
200
+ describe 'marina_prototype_create_docks test' do
201
+ it "should work" do
202
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
203
+ end
204
+ end
205
+
206
+ # unit tests for marina_prototype_create_listing_agent
207
+ # Creates a new instance in listingAgent of this model.
208
+ #
209
+ # @param id PersistedModel id
210
+ # @param [Hash] opts the optional parameters
211
+ # @option opts [ListingAgent] :data
212
+ # @return [ListingAgent]
213
+ describe 'marina_prototype_create_listing_agent test' do
214
+ it "should work" do
215
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
216
+ end
217
+ end
218
+
219
+ # unit tests for marina_prototype_delete_docks
220
+ # Deletes all docks of this model.
221
+ #
222
+ # @param id PersistedModel id
223
+ # @param [Hash] opts the optional parameters
224
+ # @return [nil]
225
+ describe 'marina_prototype_delete_docks test' do
226
+ it "should work" do
227
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
228
+ end
229
+ end
230
+
231
+ # unit tests for marina_prototype_destroy_address
232
+ # Deletes address of this model.
233
+ #
234
+ # @param id PersistedModel id
235
+ # @param [Hash] opts the optional parameters
236
+ # @return [nil]
237
+ describe 'marina_prototype_destroy_address test' do
238
+ it "should work" do
239
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
240
+ end
241
+ end
242
+
243
+ # unit tests for marina_prototype_destroy_by_id_docks
244
+ # Delete a related item by id for docks.
245
+ #
246
+ # @param fk Foreign key for docks
247
+ # @param id PersistedModel id
248
+ # @param [Hash] opts the optional parameters
249
+ # @return [nil]
250
+ describe 'marina_prototype_destroy_by_id_docks test' do
251
+ it "should work" do
252
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
253
+ end
254
+ end
255
+
256
+ # unit tests for marina_prototype_destroy_listing_agent
257
+ # Deletes listingAgent of this model.
258
+ #
259
+ # @param id PersistedModel id
260
+ # @param [Hash] opts the optional parameters
261
+ # @return [nil]
262
+ describe 'marina_prototype_destroy_listing_agent test' do
263
+ it "should work" do
264
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
265
+ end
266
+ end
267
+
268
+ # unit tests for marina_prototype_find_by_id_docks
269
+ # Find a related item by id for docks.
270
+ #
271
+ # @param fk Foreign key for docks
272
+ # @param id PersistedModel id
273
+ # @param [Hash] opts the optional parameters
274
+ # @return [Dock]
275
+ describe 'marina_prototype_find_by_id_docks test' do
276
+ it "should work" do
277
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
278
+ end
279
+ end
280
+
281
+ # unit tests for marina_prototype_get_address
282
+ # Fetches hasOne relation address.
283
+ #
284
+ # @param id PersistedModel id
285
+ # @param [Hash] opts the optional parameters
286
+ # @option opts [BOOLEAN] :refresh
287
+ # @return [Address]
288
+ describe 'marina_prototype_get_address test' do
289
+ it "should work" do
290
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
291
+ end
292
+ end
293
+
294
+ # unit tests for marina_prototype_get_docks
295
+ # Queries docks of Marina.
296
+ #
297
+ # @param id PersistedModel id
298
+ # @param [Hash] opts the optional parameters
299
+ # @option opts [String] :filter
300
+ # @return [Array<Dock>]
301
+ describe 'marina_prototype_get_docks test' do
302
+ it "should work" do
303
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
304
+ end
305
+ end
306
+
307
+ # unit tests for marina_prototype_get_listing_agent
308
+ # Fetches hasOne relation listingAgent.
309
+ #
310
+ # @param id PersistedModel id
311
+ # @param [Hash] opts the optional parameters
312
+ # @option opts [BOOLEAN] :refresh
313
+ # @return [ListingAgent]
314
+ describe 'marina_prototype_get_listing_agent test' do
315
+ it "should work" do
316
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
317
+ end
318
+ end
319
+
320
+ # unit tests for marina_prototype_update_address
321
+ # Update address of this model.
322
+ #
323
+ # @param id PersistedModel id
324
+ # @param [Hash] opts the optional parameters
325
+ # @option opts [Address] :data
326
+ # @return [Address]
327
+ describe 'marina_prototype_update_address test' do
328
+ it "should work" do
329
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
330
+ end
331
+ end
332
+
333
+ # unit tests for marina_prototype_update_attributes_patch_marinasid
334
+ # Patch attributes for a model instance and persist it into the data source.
335
+ #
336
+ # @param id PersistedModel id
337
+ # @param [Hash] opts the optional parameters
338
+ # @option opts [Marina] :data An object of model property name/value pairs
339
+ # @return [Marina]
340
+ describe 'marina_prototype_update_attributes_patch_marinasid test' do
341
+ it "should work" do
342
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
343
+ end
344
+ end
345
+
346
+ # unit tests for marina_prototype_update_attributes_put_marinasid
347
+ # Patch attributes for a model instance and persist it into the data source.
348
+ #
349
+ # @param id PersistedModel id
350
+ # @param [Hash] opts the optional parameters
351
+ # @option opts [Marina] :data An object of model property name/value pairs
352
+ # @return [Marina]
353
+ describe 'marina_prototype_update_attributes_put_marinasid test' do
354
+ it "should work" do
355
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
356
+ end
357
+ end
358
+
359
+ # unit tests for marina_prototype_update_by_id_docks
360
+ # Update a related item by id for docks.
361
+ #
362
+ # @param fk Foreign key for docks
363
+ # @param id PersistedModel id
364
+ # @param [Hash] opts the optional parameters
365
+ # @option opts [Dock] :data
366
+ # @return [Dock]
367
+ describe 'marina_prototype_update_by_id_docks test' do
368
+ it "should work" do
369
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
370
+ end
371
+ end
372
+
373
+ # unit tests for marina_prototype_update_listing_agent
374
+ # Update listingAgent of this model.
375
+ #
376
+ # @param id PersistedModel id
377
+ # @param [Hash] opts the optional parameters
378
+ # @option opts [ListingAgent] :data
379
+ # @return [ListingAgent]
380
+ describe 'marina_prototype_update_listing_agent test' do
381
+ it "should work" do
382
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
383
+ end
384
+ end
385
+
386
+ # unit tests for marina_replace_by_id
387
+ # Replace attributes for a model instance and persist it into the data source.
388
+ #
389
+ # @param id Model id
390
+ # @param [Hash] opts the optional parameters
391
+ # @option opts [Marina] :data Model instance data
392
+ # @return [Marina]
393
+ describe 'marina_replace_by_id test' do
394
+ it "should work" do
395
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
396
+ end
397
+ end
398
+
399
+ # unit tests for marina_replace_or_create
400
+ # Replace an existing model instance or insert a new one into the data source.
401
+ #
402
+ # @param [Hash] opts the optional parameters
403
+ # @option opts [Marina] :data Model instance data
404
+ # @return [Marina]
405
+ describe 'marina_replace_or_create test' do
406
+ it "should work" do
407
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
408
+ end
409
+ end
410
+
411
+ # unit tests for marina_update_all
412
+ # Update instances of the model matched by {{where}} from the data source.
413
+ #
414
+ # @param [Hash] opts the optional parameters
415
+ # @option opts [String] :where Criteria to match model instances
416
+ # @option opts [Marina] :data An object of model property name/value pairs
417
+ # @return [InlineResponse2001]
418
+ describe 'marina_update_all test' do
419
+ it "should work" do
420
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
421
+ end
422
+ end
423
+
424
+ # unit tests for marina_upsert_patch_marinas
425
+ # Patch an existing model instance or insert a new one into the data source.
426
+ #
427
+ # @param [Hash] opts the optional parameters
428
+ # @option opts [Marina] :data Model instance data
429
+ # @return [Marina]
430
+ describe 'marina_upsert_patch_marinas test' do
431
+ it "should work" do
432
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
433
+ end
434
+ end
435
+
436
+ # unit tests for marina_upsert_put_marinas
437
+ # Patch an existing model instance or insert a new one into the data source.
438
+ #
439
+ # @param [Hash] opts the optional parameters
440
+ # @option opts [Marina] :data Model instance data
441
+ # @return [Marina]
442
+ describe 'marina_upsert_put_marinas test' do
443
+ it "should work" do
444
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
445
+ end
446
+ end
447
+
448
+ # unit tests for marina_upsert_with_where
449
+ # Update an existing model instance or insert a new one into the data source based on the where criteria.
450
+ #
451
+ # @param [Hash] opts the optional parameters
452
+ # @option opts [String] :where Criteria to match model instances
453
+ # @option opts [Marina] :data An object of model property name/value pairs
454
+ # @return [Marina]
455
+ describe 'marina_upsert_with_where test' do
456
+ it "should work" do
457
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
458
+ end
459
+ end
460
+
461
+ end
@@ -0,0 +1,237 @@
1
+ =begin
2
+ #dockgenius-sl
3
+
4
+ #No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 0.1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'spec_helper'
25
+
26
+ describe DockGeniusApiRubyClient::ApiClient do
27
+ context 'initialization' do
28
+ context 'URL stuff' do
29
+ context 'host' do
30
+ it 'removes http from host' do
31
+ DockGeniusApiRubyClient.configure { |c| c.host = 'http://example.com' }
32
+ expect(DockGeniusApiRubyClient::Configuration.default.host).to eq('example.com')
33
+ end
34
+
35
+ it 'removes https from host' do
36
+ DockGeniusApiRubyClient.configure { |c| c.host = 'https://wookiee.com' }
37
+ expect(DockGeniusApiRubyClient::ApiClient.default.config.host).to eq('wookiee.com')
38
+ end
39
+
40
+ it 'removes trailing path from host' do
41
+ DockGeniusApiRubyClient.configure { |c| c.host = 'hobo.com/v4' }
42
+ expect(DockGeniusApiRubyClient::Configuration.default.host).to eq('hobo.com')
43
+ end
44
+ end
45
+
46
+ context 'base_path' do
47
+ it "prepends a slash to base_path" do
48
+ DockGeniusApiRubyClient.configure { |c| c.base_path = 'v4/dog' }
49
+ expect(DockGeniusApiRubyClient::Configuration.default.base_path).to eq('/v4/dog')
50
+ end
51
+
52
+ it "doesn't prepend a slash if one is already there" do
53
+ DockGeniusApiRubyClient.configure { |c| c.base_path = '/v4/dog' }
54
+ expect(DockGeniusApiRubyClient::Configuration.default.base_path).to eq('/v4/dog')
55
+ end
56
+
57
+ it "ends up as a blank string if nil" do
58
+ DockGeniusApiRubyClient.configure { |c| c.base_path = nil }
59
+ expect(DockGeniusApiRubyClient::Configuration.default.base_path).to eq('')
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ describe "params_encoding in #build_request" do
66
+ let(:config) { DockGeniusApiRubyClient::Configuration.new }
67
+ let(:api_client) { DockGeniusApiRubyClient::ApiClient.new(config) }
68
+
69
+ it "defaults to nil" do
70
+ expect(DockGeniusApiRubyClient::Configuration.default.params_encoding).to eq(nil)
71
+ expect(config.params_encoding).to eq(nil)
72
+
73
+ request = api_client.build_request(:get, '/test')
74
+ expect(request.options[:params_encoding]).to eq(nil)
75
+ end
76
+
77
+ it "can be customized" do
78
+ config.params_encoding = :multi
79
+ request = api_client.build_request(:get, '/test')
80
+ expect(request.options[:params_encoding]).to eq(:multi)
81
+ end
82
+ end
83
+
84
+ describe "timeout in #build_request" do
85
+ let(:config) { DockGeniusApiRubyClient::Configuration.new }
86
+ let(:api_client) { DockGeniusApiRubyClient::ApiClient.new(config) }
87
+
88
+ it "defaults to 0" do
89
+ expect(DockGeniusApiRubyClient::Configuration.default.timeout).to eq(0)
90
+ expect(config.timeout).to eq(0)
91
+
92
+ request = api_client.build_request(:get, '/test')
93
+ expect(request.options[:timeout]).to eq(0)
94
+ end
95
+
96
+ it "can be customized" do
97
+ config.timeout = 100
98
+ request = api_client.build_request(:get, '/test')
99
+ expect(request.options[:timeout]).to eq(100)
100
+ end
101
+ end
102
+
103
+ describe "#deserialize" do
104
+ it "handles Array<Integer>" do
105
+ api_client = DockGeniusApiRubyClient::ApiClient.new
106
+ headers = {'Content-Type' => 'application/json'}
107
+ response = double('response', headers: headers, body: '[12, 34]')
108
+ data = api_client.deserialize(response, 'Array<Integer>')
109
+ expect(data).to be_instance_of(Array)
110
+ expect(data).to eq([12, 34])
111
+ end
112
+
113
+ it "handles Array<Array<Integer>>" do
114
+ api_client = DockGeniusApiRubyClient::ApiClient.new
115
+ headers = {'Content-Type' => 'application/json'}
116
+ response = double('response', headers: headers, body: '[[12, 34], [56]]')
117
+ data = api_client.deserialize(response, 'Array<Array<Integer>>')
118
+ expect(data).to be_instance_of(Array)
119
+ expect(data).to eq([[12, 34], [56]])
120
+ end
121
+
122
+ it "handles Hash<String, String>" do
123
+ api_client = DockGeniusApiRubyClient::ApiClient.new
124
+ headers = {'Content-Type' => 'application/json'}
125
+ response = double('response', headers: headers, body: '{"message": "Hello"}')
126
+ data = api_client.deserialize(response, 'Hash<String, String>')
127
+ expect(data).to be_instance_of(Hash)
128
+ expect(data).to eq({:message => 'Hello'})
129
+ end
130
+ end
131
+
132
+ describe "#object_to_hash" do
133
+ it "ignores nils and includes empty arrays" do
134
+ # uncomment below to test object_to_hash for model
135
+ #api_client = DockGeniusApiRubyClient::ApiClient.new
136
+ #_model = DockGeniusApiRubyClient::ModelName.new
137
+ # update the model attribute below
138
+ #_model.id = 1
139
+ # update the expected value (hash) below
140
+ #expected = {id: 1, name: '', tags: []}
141
+ #expect(api_client.object_to_hash(_model)).to eq(expected)
142
+ end
143
+ end
144
+
145
+ describe "#build_collection_param" do
146
+ let(:param) { ['aa', 'bb', 'cc'] }
147
+ let(:api_client) { DockGeniusApiRubyClient::ApiClient.new }
148
+
149
+ it "works for csv" do
150
+ expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
151
+ end
152
+
153
+ it "works for ssv" do
154
+ expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
155
+ end
156
+
157
+ it "works for tsv" do
158
+ expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
159
+ end
160
+
161
+ it "works for pipes" do
162
+ expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
163
+ end
164
+
165
+ it "works for multi" do
166
+ expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
167
+ end
168
+
169
+ it "fails for invalid collection format" do
170
+ expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
171
+ end
172
+ end
173
+
174
+ describe "#json_mime?" do
175
+ let(:api_client) { DockGeniusApiRubyClient::ApiClient.new }
176
+
177
+ it "works" do
178
+ expect(api_client.json_mime?(nil)).to eq false
179
+ expect(api_client.json_mime?('')).to eq false
180
+
181
+ expect(api_client.json_mime?('application/json')).to eq true
182
+ expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
183
+ expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
184
+
185
+ expect(api_client.json_mime?('application/xml')).to eq false
186
+ expect(api_client.json_mime?('text/plain')).to eq false
187
+ expect(api_client.json_mime?('application/jsonp')).to eq false
188
+ end
189
+ end
190
+
191
+ describe "#select_header_accept" do
192
+ let(:api_client) { DockGeniusApiRubyClient::ApiClient.new }
193
+
194
+ it "works" do
195
+ expect(api_client.select_header_accept(nil)).to be_nil
196
+ expect(api_client.select_header_accept([])).to be_nil
197
+
198
+ expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
199
+ expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
200
+ expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
201
+
202
+ expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
203
+ expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
204
+ end
205
+ end
206
+
207
+ describe "#select_header_content_type" do
208
+ let(:api_client) { DockGeniusApiRubyClient::ApiClient.new }
209
+
210
+ it "works" do
211
+ expect(api_client.select_header_content_type(nil)).to eq('application/json')
212
+ expect(api_client.select_header_content_type([])).to eq('application/json')
213
+
214
+ expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
215
+ expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
216
+ expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
217
+ expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
218
+ expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
219
+ end
220
+ end
221
+
222
+ describe "#sanitize_filename" do
223
+ let(:api_client) { DockGeniusApiRubyClient::ApiClient.new }
224
+
225
+ it "works" do
226
+ expect(api_client.sanitize_filename('sun')).to eq('sun')
227
+ expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
228
+ expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
229
+ expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
230
+ expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
231
+ expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
232
+ expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
233
+ expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
234
+ expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
235
+ end
236
+ end
237
+ end