cloudmersive-image-recognition-api-client 1.4.2 → 2.0.1

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 (138) hide show
  1. checksums.yaml +4 -4
  2. metadata +3 -139
  3. data/Gemfile +0 -7
  4. data/README.md +0 -174
  5. data/Rakefile +0 -8
  6. data/cloudmersive-image-recognition-api-client.gemspec +0 -45
  7. data/docs/AgeDetectionResult.md +0 -10
  8. data/docs/ArtisticApi.md +0 -66
  9. data/docs/ColorResult.md +0 -10
  10. data/docs/ConvertApi.md +0 -176
  11. data/docs/DetectedLicensePlate.md +0 -14
  12. data/docs/DetectedObject.md +0 -13
  13. data/docs/DominantColorResult.md +0 -9
  14. data/docs/DrawPolygonInstance.md +0 -11
  15. data/docs/DrawPolygonRequest.md +0 -10
  16. data/docs/DrawRectangleInstance.md +0 -14
  17. data/docs/DrawRectangleRequest.md +0 -10
  18. data/docs/DrawTextInstance.md +0 -15
  19. data/docs/DrawTextRequest.md +0 -10
  20. data/docs/EditApi.md +0 -539
  21. data/docs/Face.md +0 -11
  22. data/docs/FaceApi.md +0 -396
  23. data/docs/FaceCompareResponse.md +0 -11
  24. data/docs/FaceLocateResponse.md +0 -11
  25. data/docs/FaceLocateWithLandmarksResponse.md +0 -11
  26. data/docs/FaceMatch.md +0 -13
  27. data/docs/FacePoint.md +0 -9
  28. data/docs/FaceWithLandmarks.md +0 -20
  29. data/docs/FilterApi.md +0 -478
  30. data/docs/FindSymbolResult.md +0 -13
  31. data/docs/FineTextDetectionResult.md +0 -10
  32. data/docs/FineTextItem.md +0 -18
  33. data/docs/GenderDetectionResult.md +0 -10
  34. data/docs/ImageDescriptionResponse.md +0 -11
  35. data/docs/InfoApi.md +0 -63
  36. data/docs/NsfwApi.md +0 -63
  37. data/docs/NsfwResult.md +0 -10
  38. data/docs/ObjectDetectionResult.md +0 -10
  39. data/docs/PersonWithAge.md +0 -11
  40. data/docs/PersonWithGender.md +0 -10
  41. data/docs/PolygonPoint.md +0 -9
  42. data/docs/RecognitionOutcome.md +0 -9
  43. data/docs/RecognizeApi.md +0 -455
  44. data/docs/ResizeApi.md +0 -130
  45. data/docs/TextDetectionResult.md +0 -10
  46. data/docs/TextItem.md +0 -11
  47. data/docs/VehicleLicensePlateDetectionResult.md +0 -10
  48. data/git_push.sh +0 -55
  49. data/lib/cloudmersive-image-recognition-api-client.rb +0 -80
  50. data/lib/cloudmersive-image-recognition-api-client/api/artistic_api.rb +0 -85
  51. data/lib/cloudmersive-image-recognition-api-client/api/convert_api.rb +0 -197
  52. data/lib/cloudmersive-image-recognition-api-client/api/edit_api.rb +0 -597
  53. data/lib/cloudmersive-image-recognition-api-client/api/face_api.rb +0 -422
  54. data/lib/cloudmersive-image-recognition-api-client/api/filter_api.rb +0 -533
  55. data/lib/cloudmersive-image-recognition-api-client/api/info_api.rb +0 -79
  56. data/lib/cloudmersive-image-recognition-api-client/api/nsfw_api.rb +0 -79
  57. data/lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb +0 -481
  58. data/lib/cloudmersive-image-recognition-api-client/api/resize_api.rb +0 -159
  59. data/lib/cloudmersive-image-recognition-api-client/api_client.rb +0 -389
  60. data/lib/cloudmersive-image-recognition-api-client/api_error.rb +0 -38
  61. data/lib/cloudmersive-image-recognition-api-client/configuration.rb +0 -209
  62. data/lib/cloudmersive-image-recognition-api-client/models/age_detection_result.rb +0 -211
  63. data/lib/cloudmersive-image-recognition-api-client/models/color_result.rb +0 -209
  64. data/lib/cloudmersive-image-recognition-api-client/models/detected_license_plate.rb +0 -249
  65. data/lib/cloudmersive-image-recognition-api-client/models/detected_object.rb +0 -239
  66. data/lib/cloudmersive-image-recognition-api-client/models/dominant_color_result.rb +0 -201
  67. data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_instance.rb +0 -221
  68. data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_request.rb +0 -227
  69. data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_instance.rb +0 -249
  70. data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_request.rb +0 -227
  71. data/lib/cloudmersive-image-recognition-api-client/models/draw_text_instance.rb +0 -259
  72. data/lib/cloudmersive-image-recognition-api-client/models/draw_text_request.rb +0 -227
  73. data/lib/cloudmersive-image-recognition-api-client/models/face.rb +0 -219
  74. data/lib/cloudmersive-image-recognition-api-client/models/face_compare_response.rb +0 -221
  75. data/lib/cloudmersive-image-recognition-api-client/models/face_locate_response.rb +0 -220
  76. data/lib/cloudmersive-image-recognition-api-client/models/face_locate_with_landmarks_response.rb +0 -221
  77. data/lib/cloudmersive-image-recognition-api-client/models/face_match.rb +0 -239
  78. data/lib/cloudmersive-image-recognition-api-client/models/face_point.rb +0 -199
  79. data/lib/cloudmersive-image-recognition-api-client/models/face_with_landmarks.rb +0 -327
  80. data/lib/cloudmersive-image-recognition-api-client/models/find_symbol_result.rb +0 -239
  81. data/lib/cloudmersive-image-recognition-api-client/models/fine_text_detection_result.rb +0 -211
  82. data/lib/cloudmersive-image-recognition-api-client/models/fine_text_item.rb +0 -289
  83. data/lib/cloudmersive-image-recognition-api-client/models/gender_detection_result.rb +0 -211
  84. data/lib/cloudmersive-image-recognition-api-client/models/image_description_response.rb +0 -219
  85. data/lib/cloudmersive-image-recognition-api-client/models/nsfw_result.rb +0 -209
  86. data/lib/cloudmersive-image-recognition-api-client/models/object_detection_result.rb +0 -211
  87. data/lib/cloudmersive-image-recognition-api-client/models/person_with_age.rb +0 -218
  88. data/lib/cloudmersive-image-recognition-api-client/models/person_with_gender.rb +0 -209
  89. data/lib/cloudmersive-image-recognition-api-client/models/polygon_point.rb +0 -199
  90. data/lib/cloudmersive-image-recognition-api-client/models/recognition_outcome.rb +0 -199
  91. data/lib/cloudmersive-image-recognition-api-client/models/text_detection_result.rb +0 -211
  92. data/lib/cloudmersive-image-recognition-api-client/models/text_item.rb +0 -219
  93. data/lib/cloudmersive-image-recognition-api-client/models/vehicle_license_plate_detection_result.rb +0 -211
  94. data/lib/cloudmersive-image-recognition-api-client/version.rb +0 -15
  95. data/spec/api/artistic_api_spec.rb +0 -48
  96. data/spec/api/convert_api_spec.rb +0 -72
  97. data/spec/api/edit_api_spec.rb +0 -155
  98. data/spec/api/face_api_spec.rb +0 -120
  99. data/spec/api/filter_api_spec.rb +0 -141
  100. data/spec/api/info_api_spec.rb +0 -47
  101. data/spec/api/nsfw_api_spec.rb +0 -47
  102. data/spec/api/recognize_api_spec.rb +0 -133
  103. data/spec/api/resize_api_spec.rb +0 -63
  104. data/spec/api_client_spec.rb +0 -226
  105. data/spec/configuration_spec.rb +0 -42
  106. data/spec/models/age_detection_result_spec.rb +0 -54
  107. data/spec/models/color_result_spec.rb +0 -54
  108. data/spec/models/detected_license_plate_spec.rb +0 -78
  109. data/spec/models/detected_object_spec.rb +0 -72
  110. data/spec/models/dominant_color_result_spec.rb +0 -48
  111. data/spec/models/draw_polygon_instance_spec.rb +0 -60
  112. data/spec/models/draw_polygon_request_spec.rb +0 -54
  113. data/spec/models/draw_rectangle_instance_spec.rb +0 -78
  114. data/spec/models/draw_rectangle_request_spec.rb +0 -54
  115. data/spec/models/draw_text_instance_spec.rb +0 -84
  116. data/spec/models/draw_text_request_spec.rb +0 -54
  117. data/spec/models/face_compare_response_spec.rb +0 -60
  118. data/spec/models/face_locate_response_spec.rb +0 -60
  119. data/spec/models/face_locate_with_landmarks_response_spec.rb +0 -60
  120. data/spec/models/face_match_spec.rb +0 -72
  121. data/spec/models/face_point_spec.rb +0 -48
  122. data/spec/models/face_spec.rb +0 -60
  123. data/spec/models/face_with_landmarks_spec.rb +0 -114
  124. data/spec/models/find_symbol_result_spec.rb +0 -72
  125. data/spec/models/fine_text_detection_result_spec.rb +0 -54
  126. data/spec/models/fine_text_item_spec.rb +0 -102
  127. data/spec/models/gender_detection_result_spec.rb +0 -54
  128. data/spec/models/image_description_response_spec.rb +0 -60
  129. data/spec/models/nsfw_result_spec.rb +0 -54
  130. data/spec/models/object_detection_result_spec.rb +0 -54
  131. data/spec/models/person_with_age_spec.rb +0 -60
  132. data/spec/models/person_with_gender_spec.rb +0 -54
  133. data/spec/models/polygon_point_spec.rb +0 -48
  134. data/spec/models/recognition_outcome_spec.rb +0 -48
  135. data/spec/models/text_detection_result_spec.rb +0 -54
  136. data/spec/models/text_item_spec.rb +0 -60
  137. data/spec/models/vehicle_license_plate_detection_result_spec.rb +0 -54
  138. data/spec/spec_helper.rb +0 -111
@@ -1,47 +0,0 @@
1
- =begin
2
- #imageapi
3
-
4
- #Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for CloudmersiveImageRecognitionApiClient::InfoApi
17
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
- # Please update as you see appropriate
19
- describe 'InfoApi' do
20
- before do
21
- # run before each test
22
- @instance = CloudmersiveImageRecognitionApiClient::InfoApi.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of InfoApi' do
30
- it 'should create an instance of InfoApi' do
31
- expect(@instance).to be_instance_of(CloudmersiveImageRecognitionApiClient::InfoApi)
32
- end
33
- end
34
-
35
- # unit tests for info_get_dominant_color
36
- # Returns the dominant colors of the image
37
- # Uses advanced image processing to extract the top 5 dominant colors in the image, returned in the order of dominance with the most-dominant color first. These are the primary perceptual colors used in the image as perceived by a viewer.
38
- # @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
39
- # @param [Hash] opts the optional parameters
40
- # @return [DominantColorResult]
41
- describe 'info_get_dominant_color test' do
42
- it "should work" do
43
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
- end
45
- end
46
-
47
- end
@@ -1,47 +0,0 @@
1
- =begin
2
- #imageapi
3
-
4
- #Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for CloudmersiveImageRecognitionApiClient::NsfwApi
17
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
- # Please update as you see appropriate
19
- describe 'NsfwApi' do
20
- before do
21
- # run before each test
22
- @instance = CloudmersiveImageRecognitionApiClient::NsfwApi.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of NsfwApi' do
30
- it 'should create an instance of NsfwApi' do
31
- expect(@instance).to be_instance_of(CloudmersiveImageRecognitionApiClient::NsfwApi)
32
- end
33
- end
34
-
35
- # unit tests for nsfw_classify
36
- # Not safe for work (NSFW) racy content classification
37
- # Classify an image into Not Safe For Work (NSFW)/Porn/Racy content and Safe Content.
38
- # @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
39
- # @param [Hash] opts the optional parameters
40
- # @return [NsfwResult]
41
- describe 'nsfw_classify test' do
42
- it "should work" do
43
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
- end
45
- end
46
-
47
- end
@@ -1,133 +0,0 @@
1
- =begin
2
- #imageapi
3
-
4
- #Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for CloudmersiveImageRecognitionApiClient::RecognizeApi
17
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
- # Please update as you see appropriate
19
- describe 'RecognizeApi' do
20
- before do
21
- # run before each test
22
- @instance = CloudmersiveImageRecognitionApiClient::RecognizeApi.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of RecognizeApi' do
30
- it 'should create an instance of RecognizeApi' do
31
- expect(@instance).to be_instance_of(CloudmersiveImageRecognitionApiClient::RecognizeApi)
32
- end
33
- end
34
-
35
- # unit tests for recognize_describe
36
- # Describe an image in natural language
37
- # Generate an English language text description of the image as a sentence.
38
- # @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
39
- # @param [Hash] opts the optional parameters
40
- # @return [ImageDescriptionResponse]
41
- describe 'recognize_describe test' do
42
- it "should work" do
43
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
- end
45
- end
46
-
47
- # unit tests for recognize_detect_and_unskew_document
48
- # Detect and unskew a photo of a document
49
- # Detect and unskew a photo of a document (e.g. taken on a cell phone) into a perfectly square image. Great for document scanning applications; once unskewed, this image is perfect for converting to PDF using the Convert API or optical character recognition using the OCR API.
50
- # @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
51
- # @param [Hash] opts the optional parameters
52
- # @option opts [String] :post_processing_effect Optional, post-processing effects to apply to the email, default is None. Possible values are None and BlackAndWhite (force the image into a black and white view to aid in OCR operations).
53
- # @return [String]
54
- describe 'recognize_detect_and_unskew_document test' do
55
- it "should work" do
56
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
57
- end
58
- end
59
-
60
- # unit tests for recognize_detect_objects
61
- # Detect objects, including types and locations, in an image
62
- # Identify the position, size and description of objects in an image, along with a recognition confidence level. Detects both human people and objects in an image.
63
- # @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
64
- # @param [Hash] opts the optional parameters
65
- # @return [ObjectDetectionResult]
66
- describe 'recognize_detect_objects test' do
67
- it "should work" do
68
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
69
- end
70
- end
71
-
72
- # unit tests for recognize_detect_people
73
- # Detect people, including locations, in an image
74
- # Identify the position, and size of human people in an image, along with a recognition confidence level. People in the image do NOT need to be facing the camera; they can be facing away, edge-on, etc.
75
- # @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
76
- # @param [Hash] opts the optional parameters
77
- # @return [ObjectDetectionResult]
78
- describe 'recognize_detect_people test' do
79
- it "should work" do
80
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
81
- end
82
- end
83
-
84
- # unit tests for recognize_detect_text_fine
85
- # Detect fine text in a photo of a document
86
- # Identify the position, and size of small/fine text within a photograph of a document. Identify the location of small text in a photo - such as words and other forms of high density text. Can be used on a scan of a document or a photograph (e.g. smartphone camera) of a document, page or receipt. For OCR purposes - please see our Deep Learning OCR APIs.
87
- # @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
88
- # @param [Hash] opts the optional parameters
89
- # @return [FineTextDetectionResult]
90
- describe 'recognize_detect_text_fine test' do
91
- it "should work" do
92
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
93
- end
94
- end
95
-
96
- # unit tests for recognize_detect_text_large
97
- # Detect large text in a photo
98
- # Identify the position, and size of large text within a photograph. Identify the location of large text in a photo - such as signs, titles, etc. and other forms of large, low-density text. Not suitable for high-density text (e.g. scans of documents, receipts, etc.) for OCR purposes - for OCR, please see our Deep Learning OCR APIs.
99
- # @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
100
- # @param [Hash] opts the optional parameters
101
- # @return [TextDetectionResult]
102
- describe 'recognize_detect_text_large test' do
103
- it "should work" do
104
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
105
- end
106
- end
107
-
108
- # unit tests for recognize_detect_vehicle_license_plates
109
- # Detect vehicle license plates in an image
110
- # Identify the position, and size, and content of vehicle license plates in an image. License plates should be within 15-20 degrees on-axis to the camera.
111
- # @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
112
- # @param [Hash] opts the optional parameters
113
- # @return [VehicleLicensePlateDetectionResult]
114
- describe 'recognize_detect_vehicle_license_plates test' do
115
- it "should work" do
116
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
117
- end
118
- end
119
-
120
- # unit tests for recognize_find_symbol
121
- # Find the location of a symbol in an image
122
- # Determine if an image contains a symbol, and if so, the location of that symbol in the image.
123
- # @param input_image Image file to search through for the target image.
124
- # @param target_image Image to find in the input image.
125
- # @param [Hash] opts the optional parameters
126
- # @return [FindSymbolResult]
127
- describe 'recognize_find_symbol test' do
128
- it "should work" do
129
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
130
- end
131
- end
132
-
133
- end
@@ -1,63 +0,0 @@
1
- =begin
2
- #imageapi
3
-
4
- #Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for CloudmersiveImageRecognitionApiClient::ResizeApi
17
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
- # Please update as you see appropriate
19
- describe 'ResizeApi' do
20
- before do
21
- # run before each test
22
- @instance = CloudmersiveImageRecognitionApiClient::ResizeApi.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of ResizeApi' do
30
- it 'should create an instance of ResizeApi' do
31
- expect(@instance).to be_instance_of(CloudmersiveImageRecognitionApiClient::ResizeApi)
32
- end
33
- end
34
-
35
- # unit tests for resize_post
36
- # Resize an image while preserving aspect ratio
37
- # Resize an image to a maximum width and maximum height, while preserving the image's original aspect ratio
38
- # @param max_width Maximum width of the output image - final image will be as large as possible while less than or equial to this width
39
- # @param max_height Maximum height of the output image - final image will be as large as possible while less than or equial to this height
40
- # @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
41
- # @param [Hash] opts the optional parameters
42
- # @return [String]
43
- describe 'resize_post test' do
44
- it "should work" do
45
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
46
- end
47
- end
48
-
49
- # unit tests for resize_resize_simple
50
- # Resize an image
51
- # Resize an image to a specific width and specific height
52
- # @param width
53
- # @param height
54
- # @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
55
- # @param [Hash] opts the optional parameters
56
- # @return [String]
57
- describe 'resize_resize_simple test' do
58
- it "should work" do
59
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
60
- end
61
- end
62
-
63
- end
@@ -1,226 +0,0 @@
1
- =begin
2
- #imageapi
3
-
4
- #Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
-
15
- describe CloudmersiveImageRecognitionApiClient::ApiClient do
16
- context 'initialization' do
17
- context 'URL stuff' do
18
- context 'host' do
19
- it 'removes http from host' do
20
- CloudmersiveImageRecognitionApiClient.configure { |c| c.host = 'http://example.com' }
21
- expect(CloudmersiveImageRecognitionApiClient::Configuration.default.host).to eq('example.com')
22
- end
23
-
24
- it 'removes https from host' do
25
- CloudmersiveImageRecognitionApiClient.configure { |c| c.host = 'https://wookiee.com' }
26
- expect(CloudmersiveImageRecognitionApiClient::ApiClient.default.config.host).to eq('wookiee.com')
27
- end
28
-
29
- it 'removes trailing path from host' do
30
- CloudmersiveImageRecognitionApiClient.configure { |c| c.host = 'hobo.com/v4' }
31
- expect(CloudmersiveImageRecognitionApiClient::Configuration.default.host).to eq('hobo.com')
32
- end
33
- end
34
-
35
- context 'base_path' do
36
- it "prepends a slash to base_path" do
37
- CloudmersiveImageRecognitionApiClient.configure { |c| c.base_path = 'v4/dog' }
38
- expect(CloudmersiveImageRecognitionApiClient::Configuration.default.base_path).to eq('/v4/dog')
39
- end
40
-
41
- it "doesn't prepend a slash if one is already there" do
42
- CloudmersiveImageRecognitionApiClient.configure { |c| c.base_path = '/v4/dog' }
43
- expect(CloudmersiveImageRecognitionApiClient::Configuration.default.base_path).to eq('/v4/dog')
44
- end
45
-
46
- it "ends up as a blank string if nil" do
47
- CloudmersiveImageRecognitionApiClient.configure { |c| c.base_path = nil }
48
- expect(CloudmersiveImageRecognitionApiClient::Configuration.default.base_path).to eq('')
49
- end
50
- end
51
- end
52
- end
53
-
54
- describe "params_encoding in #build_request" do
55
- let(:config) { CloudmersiveImageRecognitionApiClient::Configuration.new }
56
- let(:api_client) { CloudmersiveImageRecognitionApiClient::ApiClient.new(config) }
57
-
58
- it "defaults to nil" do
59
- expect(CloudmersiveImageRecognitionApiClient::Configuration.default.params_encoding).to eq(nil)
60
- expect(config.params_encoding).to eq(nil)
61
-
62
- request = api_client.build_request(:get, '/test')
63
- expect(request.options[:params_encoding]).to eq(nil)
64
- end
65
-
66
- it "can be customized" do
67
- config.params_encoding = :multi
68
- request = api_client.build_request(:get, '/test')
69
- expect(request.options[:params_encoding]).to eq(:multi)
70
- end
71
- end
72
-
73
- describe "timeout in #build_request" do
74
- let(:config) { CloudmersiveImageRecognitionApiClient::Configuration.new }
75
- let(:api_client) { CloudmersiveImageRecognitionApiClient::ApiClient.new(config) }
76
-
77
- it "defaults to 0" do
78
- expect(CloudmersiveImageRecognitionApiClient::Configuration.default.timeout).to eq(0)
79
- expect(config.timeout).to eq(0)
80
-
81
- request = api_client.build_request(:get, '/test')
82
- expect(request.options[:timeout]).to eq(0)
83
- end
84
-
85
- it "can be customized" do
86
- config.timeout = 100
87
- request = api_client.build_request(:get, '/test')
88
- expect(request.options[:timeout]).to eq(100)
89
- end
90
- end
91
-
92
- describe "#deserialize" do
93
- it "handles Array<Integer>" do
94
- api_client = CloudmersiveImageRecognitionApiClient::ApiClient.new
95
- headers = {'Content-Type' => 'application/json'}
96
- response = double('response', headers: headers, body: '[12, 34]')
97
- data = api_client.deserialize(response, 'Array<Integer>')
98
- expect(data).to be_instance_of(Array)
99
- expect(data).to eq([12, 34])
100
- end
101
-
102
- it "handles Array<Array<Integer>>" do
103
- api_client = CloudmersiveImageRecognitionApiClient::ApiClient.new
104
- headers = {'Content-Type' => 'application/json'}
105
- response = double('response', headers: headers, body: '[[12, 34], [56]]')
106
- data = api_client.deserialize(response, 'Array<Array<Integer>>')
107
- expect(data).to be_instance_of(Array)
108
- expect(data).to eq([[12, 34], [56]])
109
- end
110
-
111
- it "handles Hash<String, String>" do
112
- api_client = CloudmersiveImageRecognitionApiClient::ApiClient.new
113
- headers = {'Content-Type' => 'application/json'}
114
- response = double('response', headers: headers, body: '{"message": "Hello"}')
115
- data = api_client.deserialize(response, 'Hash<String, String>')
116
- expect(data).to be_instance_of(Hash)
117
- expect(data).to eq({:message => 'Hello'})
118
- end
119
- end
120
-
121
- describe "#object_to_hash" do
122
- it "ignores nils and includes empty arrays" do
123
- # uncomment below to test object_to_hash for model
124
- #api_client = CloudmersiveImageRecognitionApiClient::ApiClient.new
125
- #_model = CloudmersiveImageRecognitionApiClient::ModelName.new
126
- # update the model attribute below
127
- #_model.id = 1
128
- # update the expected value (hash) below
129
- #expected = {id: 1, name: '', tags: []}
130
- #expect(api_client.object_to_hash(_model)).to eq(expected)
131
- end
132
- end
133
-
134
- describe "#build_collection_param" do
135
- let(:param) { ['aa', 'bb', 'cc'] }
136
- let(:api_client) { CloudmersiveImageRecognitionApiClient::ApiClient.new }
137
-
138
- it "works for csv" do
139
- expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
140
- end
141
-
142
- it "works for ssv" do
143
- expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
144
- end
145
-
146
- it "works for tsv" do
147
- expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
148
- end
149
-
150
- it "works for pipes" do
151
- expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
152
- end
153
-
154
- it "works for multi" do
155
- expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
156
- end
157
-
158
- it "fails for invalid collection format" do
159
- expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
160
- end
161
- end
162
-
163
- describe "#json_mime?" do
164
- let(:api_client) { CloudmersiveImageRecognitionApiClient::ApiClient.new }
165
-
166
- it "works" do
167
- expect(api_client.json_mime?(nil)).to eq false
168
- expect(api_client.json_mime?('')).to eq false
169
-
170
- expect(api_client.json_mime?('application/json')).to eq true
171
- expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
172
- expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
173
-
174
- expect(api_client.json_mime?('application/xml')).to eq false
175
- expect(api_client.json_mime?('text/plain')).to eq false
176
- expect(api_client.json_mime?('application/jsonp')).to eq false
177
- end
178
- end
179
-
180
- describe "#select_header_accept" do
181
- let(:api_client) { CloudmersiveImageRecognitionApiClient::ApiClient.new }
182
-
183
- it "works" do
184
- expect(api_client.select_header_accept(nil)).to be_nil
185
- expect(api_client.select_header_accept([])).to be_nil
186
-
187
- expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
188
- expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
189
- expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
190
-
191
- expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
192
- expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
193
- end
194
- end
195
-
196
- describe "#select_header_content_type" do
197
- let(:api_client) { CloudmersiveImageRecognitionApiClient::ApiClient.new }
198
-
199
- it "works" do
200
- expect(api_client.select_header_content_type(nil)).to eq('application/json')
201
- expect(api_client.select_header_content_type([])).to eq('application/json')
202
-
203
- expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
204
- expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
205
- expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
206
- expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
207
- expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
208
- end
209
- end
210
-
211
- describe "#sanitize_filename" do
212
- let(:api_client) { CloudmersiveImageRecognitionApiClient::ApiClient.new }
213
-
214
- it "works" do
215
- expect(api_client.sanitize_filename('sun')).to eq('sun')
216
- expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
217
- expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
218
- expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
219
- expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
220
- expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
221
- expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
222
- expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
223
- expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
224
- end
225
- end
226
- end