cloudmersive-image-recognition-api-client 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -4
- data/docs/DrawPolygonInstance.md +11 -0
- data/docs/DrawPolygonRequest.md +10 -0
- data/docs/EditApi.md +110 -0
- data/docs/PolygonPoint.md +9 -0
- data/lib/cloudmersive-image-recognition-api-client.rb +3 -0
- data/lib/cloudmersive-image-recognition-api-client/api/edit_api.rb +108 -0
- data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_instance.rb +221 -0
- data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_request.rb +227 -0
- data/lib/cloudmersive-image-recognition-api-client/models/polygon_point.rb +199 -0
- data/lib/cloudmersive-image-recognition-api-client/version.rb +1 -1
- data/spec/api/edit_api_spec.rb +24 -0
- data/spec/models/draw_polygon_instance_spec.rb +60 -0
- data/spec/models/draw_polygon_request_spec.rb +54 -0
- data/spec/models/polygon_point_spec.rb +48 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4baaa30002589997478eda1480110c69ed8e974c83054f1db076ac740edad218
|
4
|
+
data.tar.gz: 38bb280d935f6d396cd446755d1fe7ddc52858336116c2c487b7860008ee7383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 613d382fbbcd144cfef09b51768d2902064e269ca79ae937e9ba0c21d1bf4a44ba66a1d5d7cbfd3e3e70a43634803ab9cd4e594d21fcdf41e9183b44f4cd4bcb
|
7
|
+
data.tar.gz: 488e7a5edf5e0e2c058e95d1e0a84c1a9ac363695d9344f74c753e4f5234fd06adba1761bda8e9b8cb47808e684086037a5fdaaf0da0204bada42d40e31d071d
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Image Recognition and Processing APIs let you use Machine Learning to recognize
|
|
7
7
|
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
8
|
|
9
9
|
- API version: v1
|
10
|
-
- Package version: 1.3.
|
10
|
+
- Package version: 1.3.6
|
11
11
|
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
12
12
|
|
13
13
|
## Installation
|
@@ -23,15 +23,15 @@ gem build cloudmersive-image-recognition-api-client.gemspec
|
|
23
23
|
Then either install the gem locally:
|
24
24
|
|
25
25
|
```shell
|
26
|
-
gem install ./cloudmersive-image-recognition-api-client-1.3.
|
26
|
+
gem install ./cloudmersive-image-recognition-api-client-1.3.6.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-image-recognition-api-client-1.3.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-image-recognition-api-client-1.3.6.gem` to install the development dependencies)
|
29
29
|
|
30
30
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
31
|
|
32
32
|
Finally add this to the Gemfile:
|
33
33
|
|
34
|
-
gem 'cloudmersive-image-recognition-api-client', '~> 1.3.
|
34
|
+
gem 'cloudmersive-image-recognition-api-client', '~> 1.3.6'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -89,8 +89,10 @@ Class | Method | HTTP request | Description
|
|
89
89
|
*CloudmersiveImageRecognitionApiClient::EditApi* | [**edit_auto_orient**](docs/EditApi.md#edit_auto_orient) | **POST** /image/edit/auto-orient/remove-exif | Normalizes image rotation and removes EXIF rotation data
|
90
90
|
*CloudmersiveImageRecognitionApiClient::EditApi* | [**edit_composite_basic**](docs/EditApi.md#edit_composite_basic) | **POST** /image/edit/composite/{location} | Composite two images together
|
91
91
|
*CloudmersiveImageRecognitionApiClient::EditApi* | [**edit_contrast_adaptive**](docs/EditApi.md#edit_contrast_adaptive) | **POST** /image/edit/contrast/{gamma}/adaptive | Adaptively adjust the contrast of the image to be more appealing and easy to see
|
92
|
+
*CloudmersiveImageRecognitionApiClient::EditApi* | [**edit_draw_polygon**](docs/EditApi.md#edit_draw_polygon) | **POST** /image/edit/draw/polygon | Draw polygon onto an image
|
92
93
|
*CloudmersiveImageRecognitionApiClient::EditApi* | [**edit_draw_rectangle**](docs/EditApi.md#edit_draw_rectangle) | **POST** /image/edit/draw/rectangle | Draw rectangle onto an image
|
93
94
|
*CloudmersiveImageRecognitionApiClient::EditApi* | [**edit_draw_text**](docs/EditApi.md#edit_draw_text) | **POST** /image/edit/draw/text | Draw text onto an image
|
95
|
+
*CloudmersiveImageRecognitionApiClient::EditApi* | [**edit_rotate**](docs/EditApi.md#edit_rotate) | **POST** /image/edit/rotate/{degrees}/angle | Rotate an image any number of degrees
|
94
96
|
*CloudmersiveImageRecognitionApiClient::FaceApi* | [**face_compare**](docs/FaceApi.md#face_compare) | **POST** /image/face/compare-and-match | Compare and match faces
|
95
97
|
*CloudmersiveImageRecognitionApiClient::FaceApi* | [**face_crop_first**](docs/FaceApi.md#face_crop_first) | **POST** /image/face/crop/first | Crop image to face (square)
|
96
98
|
*CloudmersiveImageRecognitionApiClient::FaceApi* | [**face_crop_first_round**](docs/FaceApi.md#face_crop_first_round) | **POST** /image/face/crop/first/round | Crop image to face (round)
|
@@ -113,6 +115,8 @@ Class | Method | HTTP request | Description
|
|
113
115
|
- [CloudmersiveImageRecognitionApiClient::AgeDetectionResult](docs/AgeDetectionResult.md)
|
114
116
|
- [CloudmersiveImageRecognitionApiClient::DetectedLicensePlate](docs/DetectedLicensePlate.md)
|
115
117
|
- [CloudmersiveImageRecognitionApiClient::DetectedObject](docs/DetectedObject.md)
|
118
|
+
- [CloudmersiveImageRecognitionApiClient::DrawPolygonInstance](docs/DrawPolygonInstance.md)
|
119
|
+
- [CloudmersiveImageRecognitionApiClient::DrawPolygonRequest](docs/DrawPolygonRequest.md)
|
116
120
|
- [CloudmersiveImageRecognitionApiClient::DrawRectangleInstance](docs/DrawRectangleInstance.md)
|
117
121
|
- [CloudmersiveImageRecognitionApiClient::DrawRectangleRequest](docs/DrawRectangleRequest.md)
|
118
122
|
- [CloudmersiveImageRecognitionApiClient::DrawTextInstance](docs/DrawTextInstance.md)
|
@@ -130,6 +134,7 @@ Class | Method | HTTP request | Description
|
|
130
134
|
- [CloudmersiveImageRecognitionApiClient::NsfwResult](docs/NsfwResult.md)
|
131
135
|
- [CloudmersiveImageRecognitionApiClient::ObjectDetectionResult](docs/ObjectDetectionResult.md)
|
132
136
|
- [CloudmersiveImageRecognitionApiClient::PersonWithAge](docs/PersonWithAge.md)
|
137
|
+
- [CloudmersiveImageRecognitionApiClient::PolygonPoint](docs/PolygonPoint.md)
|
133
138
|
- [CloudmersiveImageRecognitionApiClient::RecognitionOutcome](docs/RecognitionOutcome.md)
|
134
139
|
- [CloudmersiveImageRecognitionApiClient::TextDetectionResult](docs/TextDetectionResult.md)
|
135
140
|
- [CloudmersiveImageRecognitionApiClient::TextItem](docs/TextItem.md)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# CloudmersiveImageRecognitionApiClient::DrawPolygonInstance
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**border_color** | **String** | Border Color to use - can be a hex value (with #) or HTML common color name. Transparent colors are supported. | [optional]
|
7
|
+
**border_width** | **Float** | Width in pixels of the border. Pass in 0 to draw a polygon with no border | [optional]
|
8
|
+
**fill_color** | **String** | Fill Color to use - can be a hex value (with #) or HTML common color name. Transparent colors are supported. Leave blank to not fill the polygon. | [optional]
|
9
|
+
**points** | [**Array<PolygonPoint>**](PolygonPoint.md) | Points (vertices) which comprise the polygon; valid polygons must have at least 3 points | [optional]
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# CloudmersiveImageRecognitionApiClient::DrawPolygonRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**base_image_bytes** | **String** | Image to draw polygons on, in bytes. You can also use the BaseImageUrl instead to supply image input as a URL | [optional]
|
7
|
+
**base_image_url** | **String** | Image to draw polygons on, as an HTTP or HTTPS fully-qualified URL | [optional]
|
8
|
+
**polygons_to_draw** | [**Array<DrawPolygonInstance>**](DrawPolygonInstance.md) | Polygons to draw on the image. Polygons are drawn in index order. | [optional]
|
9
|
+
|
10
|
+
|
data/docs/EditApi.md
CHANGED
@@ -7,8 +7,10 @@ Method | HTTP request | Description
|
|
7
7
|
[**edit_auto_orient**](EditApi.md#edit_auto_orient) | **POST** /image/edit/auto-orient/remove-exif | Normalizes image rotation and removes EXIF rotation data
|
8
8
|
[**edit_composite_basic**](EditApi.md#edit_composite_basic) | **POST** /image/edit/composite/{location} | Composite two images together
|
9
9
|
[**edit_contrast_adaptive**](EditApi.md#edit_contrast_adaptive) | **POST** /image/edit/contrast/{gamma}/adaptive | Adaptively adjust the contrast of the image to be more appealing and easy to see
|
10
|
+
[**edit_draw_polygon**](EditApi.md#edit_draw_polygon) | **POST** /image/edit/draw/polygon | Draw polygon onto an image
|
10
11
|
[**edit_draw_rectangle**](EditApi.md#edit_draw_rectangle) | **POST** /image/edit/draw/rectangle | Draw rectangle onto an image
|
11
12
|
[**edit_draw_text**](EditApi.md#edit_draw_text) | **POST** /image/edit/draw/text | Draw text onto an image
|
13
|
+
[**edit_rotate**](EditApi.md#edit_rotate) | **POST** /image/edit/rotate/{degrees}/angle | Rotate an image any number of degrees
|
12
14
|
|
13
15
|
|
14
16
|
# **edit_auto_orient**
|
@@ -182,6 +184,60 @@ Name | Type | Description | Notes
|
|
182
184
|
|
183
185
|
|
184
186
|
|
187
|
+
# **edit_draw_polygon**
|
188
|
+
> Object edit_draw_polygon(request)
|
189
|
+
|
190
|
+
Draw polygon onto an image
|
191
|
+
|
192
|
+
Draw one or more polygons, with customized visuals, onto an image
|
193
|
+
|
194
|
+
### Example
|
195
|
+
```ruby
|
196
|
+
# load the gem
|
197
|
+
require 'cloudmersive-image-recognition-api-client'
|
198
|
+
# setup authorization
|
199
|
+
CloudmersiveImageRecognitionApiClient.configure do |config|
|
200
|
+
# Configure API key authorization: Apikey
|
201
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
202
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
203
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
204
|
+
end
|
205
|
+
|
206
|
+
api_instance = CloudmersiveImageRecognitionApiClient::EditApi.new
|
207
|
+
|
208
|
+
request = CloudmersiveImageRecognitionApiClient::DrawPolygonRequest.new # DrawPolygonRequest |
|
209
|
+
|
210
|
+
|
211
|
+
begin
|
212
|
+
#Draw polygon onto an image
|
213
|
+
result = api_instance.edit_draw_polygon(request)
|
214
|
+
p result
|
215
|
+
rescue CloudmersiveImageRecognitionApiClient::ApiError => e
|
216
|
+
puts "Exception when calling EditApi->edit_draw_polygon: #{e}"
|
217
|
+
end
|
218
|
+
```
|
219
|
+
|
220
|
+
### Parameters
|
221
|
+
|
222
|
+
Name | Type | Description | Notes
|
223
|
+
------------- | ------------- | ------------- | -------------
|
224
|
+
**request** | [**DrawPolygonRequest**](DrawPolygonRequest.md)| |
|
225
|
+
|
226
|
+
### Return type
|
227
|
+
|
228
|
+
**Object**
|
229
|
+
|
230
|
+
### Authorization
|
231
|
+
|
232
|
+
[Apikey](../README.md#Apikey)
|
233
|
+
|
234
|
+
### HTTP request headers
|
235
|
+
|
236
|
+
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
237
|
+
- **Accept**: image/png
|
238
|
+
|
239
|
+
|
240
|
+
|
185
241
|
# **edit_draw_rectangle**
|
186
242
|
> String edit_draw_rectangle(request)
|
187
243
|
|
@@ -290,3 +346,57 @@ Name | Type | Description | Notes
|
|
290
346
|
|
291
347
|
|
292
348
|
|
349
|
+
# **edit_rotate**
|
350
|
+
> Object edit_rotate(degrees)
|
351
|
+
|
352
|
+
Rotate an image any number of degrees
|
353
|
+
|
354
|
+
Rotates an image by an arbitrary number of degrees
|
355
|
+
|
356
|
+
### Example
|
357
|
+
```ruby
|
358
|
+
# load the gem
|
359
|
+
require 'cloudmersive-image-recognition-api-client'
|
360
|
+
# setup authorization
|
361
|
+
CloudmersiveImageRecognitionApiClient.configure do |config|
|
362
|
+
# Configure API key authorization: Apikey
|
363
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
364
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
365
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
366
|
+
end
|
367
|
+
|
368
|
+
api_instance = CloudmersiveImageRecognitionApiClient::EditApi.new
|
369
|
+
|
370
|
+
degrees = 1.2 # Float | Degrees to rotate the image; values range from 0.0 to 360.0.
|
371
|
+
|
372
|
+
|
373
|
+
begin
|
374
|
+
#Rotate an image any number of degrees
|
375
|
+
result = api_instance.edit_rotate(degrees)
|
376
|
+
p result
|
377
|
+
rescue CloudmersiveImageRecognitionApiClient::ApiError => e
|
378
|
+
puts "Exception when calling EditApi->edit_rotate: #{e}"
|
379
|
+
end
|
380
|
+
```
|
381
|
+
|
382
|
+
### Parameters
|
383
|
+
|
384
|
+
Name | Type | Description | Notes
|
385
|
+
------------- | ------------- | ------------- | -------------
|
386
|
+
**degrees** | **Float**| Degrees to rotate the image; values range from 0.0 to 360.0. |
|
387
|
+
|
388
|
+
### Return type
|
389
|
+
|
390
|
+
**Object**
|
391
|
+
|
392
|
+
### Authorization
|
393
|
+
|
394
|
+
[Apikey](../README.md#Apikey)
|
395
|
+
|
396
|
+
### HTTP request headers
|
397
|
+
|
398
|
+
- **Content-Type**: Not defined
|
399
|
+
- **Accept**: application/octet-stream
|
400
|
+
|
401
|
+
|
402
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveImageRecognitionApiClient::PolygonPoint
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**x** | **Float** | X location in pixels of this point in the polygon | [optional]
|
7
|
+
**y** | **Float** | Y location in pixels of this point in the polygon | [optional]
|
8
|
+
|
9
|
+
|
@@ -20,6 +20,8 @@ require 'cloudmersive-image-recognition-api-client/configuration'
|
|
20
20
|
require 'cloudmersive-image-recognition-api-client/models/age_detection_result'
|
21
21
|
require 'cloudmersive-image-recognition-api-client/models/detected_license_plate'
|
22
22
|
require 'cloudmersive-image-recognition-api-client/models/detected_object'
|
23
|
+
require 'cloudmersive-image-recognition-api-client/models/draw_polygon_instance'
|
24
|
+
require 'cloudmersive-image-recognition-api-client/models/draw_polygon_request'
|
23
25
|
require 'cloudmersive-image-recognition-api-client/models/draw_rectangle_instance'
|
24
26
|
require 'cloudmersive-image-recognition-api-client/models/draw_rectangle_request'
|
25
27
|
require 'cloudmersive-image-recognition-api-client/models/draw_text_instance'
|
@@ -37,6 +39,7 @@ require 'cloudmersive-image-recognition-api-client/models/image_description_resp
|
|
37
39
|
require 'cloudmersive-image-recognition-api-client/models/nsfw_result'
|
38
40
|
require 'cloudmersive-image-recognition-api-client/models/object_detection_result'
|
39
41
|
require 'cloudmersive-image-recognition-api-client/models/person_with_age'
|
42
|
+
require 'cloudmersive-image-recognition-api-client/models/polygon_point'
|
40
43
|
require 'cloudmersive-image-recognition-api-client/models/recognition_outcome'
|
41
44
|
require 'cloudmersive-image-recognition-api-client/models/text_detection_result'
|
42
45
|
require 'cloudmersive-image-recognition-api-client/models/text_item'
|
@@ -207,6 +207,61 @@ module CloudmersiveImageRecognitionApiClient
|
|
207
207
|
return data, status_code, headers
|
208
208
|
end
|
209
209
|
|
210
|
+
# Draw polygon onto an image
|
211
|
+
# Draw one or more polygons, with customized visuals, onto an image
|
212
|
+
# @param request
|
213
|
+
# @param [Hash] opts the optional parameters
|
214
|
+
# @return [Object]
|
215
|
+
def edit_draw_polygon(request, opts = {})
|
216
|
+
data, _status_code, _headers = edit_draw_polygon_with_http_info(request, opts)
|
217
|
+
return data
|
218
|
+
end
|
219
|
+
|
220
|
+
# Draw polygon onto an image
|
221
|
+
# Draw one or more polygons, with customized visuals, onto an image
|
222
|
+
# @param request
|
223
|
+
# @param [Hash] opts the optional parameters
|
224
|
+
# @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
|
225
|
+
def edit_draw_polygon_with_http_info(request, opts = {})
|
226
|
+
if @api_client.config.debugging
|
227
|
+
@api_client.config.logger.debug "Calling API: EditApi.edit_draw_polygon ..."
|
228
|
+
end
|
229
|
+
# verify the required parameter 'request' is set
|
230
|
+
if @api_client.config.client_side_validation && request.nil?
|
231
|
+
fail ArgumentError, "Missing the required parameter 'request' when calling EditApi.edit_draw_polygon"
|
232
|
+
end
|
233
|
+
# resource path
|
234
|
+
local_var_path = "/image/edit/draw/polygon"
|
235
|
+
|
236
|
+
# query parameters
|
237
|
+
query_params = {}
|
238
|
+
|
239
|
+
# header parameters
|
240
|
+
header_params = {}
|
241
|
+
# HTTP header 'Accept' (if needed)
|
242
|
+
header_params['Accept'] = @api_client.select_header_accept(['image/png'])
|
243
|
+
# HTTP header 'Content-Type'
|
244
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
245
|
+
|
246
|
+
# form parameters
|
247
|
+
form_params = {}
|
248
|
+
|
249
|
+
# http body (model)
|
250
|
+
post_body = @api_client.object_to_http_body(request)
|
251
|
+
auth_names = ['Apikey']
|
252
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
253
|
+
:header_params => header_params,
|
254
|
+
:query_params => query_params,
|
255
|
+
:form_params => form_params,
|
256
|
+
:body => post_body,
|
257
|
+
:auth_names => auth_names,
|
258
|
+
:return_type => 'Object')
|
259
|
+
if @api_client.config.debugging
|
260
|
+
@api_client.config.logger.debug "API called: EditApi#edit_draw_polygon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
261
|
+
end
|
262
|
+
return data, status_code, headers
|
263
|
+
end
|
264
|
+
|
210
265
|
# Draw rectangle onto an image
|
211
266
|
# Draw one or more rectangles, with customized visuals, onto an image
|
212
267
|
# @param request
|
@@ -316,5 +371,58 @@ module CloudmersiveImageRecognitionApiClient
|
|
316
371
|
end
|
317
372
|
return data, status_code, headers
|
318
373
|
end
|
374
|
+
|
375
|
+
# Rotate an image any number of degrees
|
376
|
+
# Rotates an image by an arbitrary number of degrees
|
377
|
+
# @param degrees Degrees to rotate the image; values range from 0.0 to 360.0.
|
378
|
+
# @param [Hash] opts the optional parameters
|
379
|
+
# @return [Object]
|
380
|
+
def edit_rotate(degrees, opts = {})
|
381
|
+
data, _status_code, _headers = edit_rotate_with_http_info(degrees, opts)
|
382
|
+
return data
|
383
|
+
end
|
384
|
+
|
385
|
+
# Rotate an image any number of degrees
|
386
|
+
# Rotates an image by an arbitrary number of degrees
|
387
|
+
# @param degrees Degrees to rotate the image; values range from 0.0 to 360.0.
|
388
|
+
# @param [Hash] opts the optional parameters
|
389
|
+
# @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
|
390
|
+
def edit_rotate_with_http_info(degrees, opts = {})
|
391
|
+
if @api_client.config.debugging
|
392
|
+
@api_client.config.logger.debug "Calling API: EditApi.edit_rotate ..."
|
393
|
+
end
|
394
|
+
# verify the required parameter 'degrees' is set
|
395
|
+
if @api_client.config.client_side_validation && degrees.nil?
|
396
|
+
fail ArgumentError, "Missing the required parameter 'degrees' when calling EditApi.edit_rotate"
|
397
|
+
end
|
398
|
+
# resource path
|
399
|
+
local_var_path = "/image/edit/rotate/{degrees}/angle".sub('{' + 'degrees' + '}', degrees.to_s)
|
400
|
+
|
401
|
+
# query parameters
|
402
|
+
query_params = {}
|
403
|
+
|
404
|
+
# header parameters
|
405
|
+
header_params = {}
|
406
|
+
# HTTP header 'Accept' (if needed)
|
407
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
|
408
|
+
|
409
|
+
# form parameters
|
410
|
+
form_params = {}
|
411
|
+
|
412
|
+
# http body (model)
|
413
|
+
post_body = nil
|
414
|
+
auth_names = ['Apikey']
|
415
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
416
|
+
:header_params => header_params,
|
417
|
+
:query_params => query_params,
|
418
|
+
:form_params => form_params,
|
419
|
+
:body => post_body,
|
420
|
+
:auth_names => auth_names,
|
421
|
+
:return_type => 'Object')
|
422
|
+
if @api_client.config.debugging
|
423
|
+
@api_client.config.logger.debug "API called: EditApi#edit_rotate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
424
|
+
end
|
425
|
+
return data, status_code, headers
|
426
|
+
end
|
319
427
|
end
|
320
428
|
end
|
@@ -0,0 +1,221 @@
|
|
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: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveImageRecognitionApiClient
|
16
|
+
# Polygon instance to draw on an image
|
17
|
+
class DrawPolygonInstance
|
18
|
+
# Border Color to use - can be a hex value (with #) or HTML common color name. Transparent colors are supported.
|
19
|
+
attr_accessor :border_color
|
20
|
+
|
21
|
+
# Width in pixels of the border. Pass in 0 to draw a polygon with no border
|
22
|
+
attr_accessor :border_width
|
23
|
+
|
24
|
+
# Fill Color to use - can be a hex value (with #) or HTML common color name. Transparent colors are supported. Leave blank to not fill the polygon.
|
25
|
+
attr_accessor :fill_color
|
26
|
+
|
27
|
+
# Points (vertices) which comprise the polygon; valid polygons must have at least 3 points
|
28
|
+
attr_accessor :points
|
29
|
+
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'border_color' => :'BorderColor',
|
35
|
+
:'border_width' => :'BorderWidth',
|
36
|
+
:'fill_color' => :'FillColor',
|
37
|
+
:'points' => :'Points'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.swagger_types
|
43
|
+
{
|
44
|
+
:'border_color' => :'String',
|
45
|
+
:'border_width' => :'Float',
|
46
|
+
:'fill_color' => :'String',
|
47
|
+
:'points' => :'Array<PolygonPoint>'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
return unless attributes.is_a?(Hash)
|
55
|
+
|
56
|
+
# convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
58
|
+
|
59
|
+
if attributes.has_key?(:'BorderColor')
|
60
|
+
self.border_color = attributes[:'BorderColor']
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes.has_key?(:'BorderWidth')
|
64
|
+
self.border_width = attributes[:'BorderWidth']
|
65
|
+
end
|
66
|
+
|
67
|
+
if attributes.has_key?(:'FillColor')
|
68
|
+
self.fill_color = attributes[:'FillColor']
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes.has_key?(:'Points')
|
72
|
+
if (value = attributes[:'Points']).is_a?(Array)
|
73
|
+
self.points = value
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
80
|
+
# @return Array for valid properties with the reasons
|
81
|
+
def list_invalid_properties
|
82
|
+
invalid_properties = Array.new
|
83
|
+
return invalid_properties
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check to see if the all the properties in the model are valid
|
87
|
+
# @return true if the model is valid
|
88
|
+
def valid?
|
89
|
+
return true
|
90
|
+
end
|
91
|
+
|
92
|
+
# Checks equality by comparing each attribute.
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def ==(o)
|
95
|
+
return true if self.equal?(o)
|
96
|
+
self.class == o.class &&
|
97
|
+
border_color == o.border_color &&
|
98
|
+
border_width == o.border_width &&
|
99
|
+
fill_color == o.fill_color &&
|
100
|
+
points == o.points
|
101
|
+
end
|
102
|
+
|
103
|
+
# @see the `==` method
|
104
|
+
# @param [Object] Object to be compared
|
105
|
+
def eql?(o)
|
106
|
+
self == o
|
107
|
+
end
|
108
|
+
|
109
|
+
# Calculates hash code according to all attributes.
|
110
|
+
# @return [Fixnum] Hash code
|
111
|
+
def hash
|
112
|
+
[border_color, border_width, fill_color, points].hash
|
113
|
+
end
|
114
|
+
|
115
|
+
# Builds the object from hash
|
116
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
117
|
+
# @return [Object] Returns the model itself
|
118
|
+
def build_from_hash(attributes)
|
119
|
+
return nil unless attributes.is_a?(Hash)
|
120
|
+
self.class.swagger_types.each_pair do |key, type|
|
121
|
+
if type =~ /\AArray<(.*)>/i
|
122
|
+
# check to ensure the input is an array given that the the attribute
|
123
|
+
# is documented as an array but the input is not
|
124
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
125
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
126
|
+
end
|
127
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
128
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
129
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
130
|
+
end
|
131
|
+
|
132
|
+
self
|
133
|
+
end
|
134
|
+
|
135
|
+
# Deserializes the data based on type
|
136
|
+
# @param string type Data type
|
137
|
+
# @param string value Value to be deserialized
|
138
|
+
# @return [Object] Deserialized data
|
139
|
+
def _deserialize(type, value)
|
140
|
+
case type.to_sym
|
141
|
+
when :DateTime
|
142
|
+
DateTime.parse(value)
|
143
|
+
when :Date
|
144
|
+
Date.parse(value)
|
145
|
+
when :String
|
146
|
+
value.to_s
|
147
|
+
when :Integer
|
148
|
+
value.to_i
|
149
|
+
when :Float
|
150
|
+
value.to_f
|
151
|
+
when :BOOLEAN
|
152
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
153
|
+
true
|
154
|
+
else
|
155
|
+
false
|
156
|
+
end
|
157
|
+
when :Object
|
158
|
+
# generic object (usually a Hash), return directly
|
159
|
+
value
|
160
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
161
|
+
inner_type = Regexp.last_match[:inner_type]
|
162
|
+
value.map { |v| _deserialize(inner_type, v) }
|
163
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
164
|
+
k_type = Regexp.last_match[:k_type]
|
165
|
+
v_type = Regexp.last_match[:v_type]
|
166
|
+
{}.tap do |hash|
|
167
|
+
value.each do |k, v|
|
168
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
else # model
|
172
|
+
temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
|
173
|
+
temp_model.build_from_hash(value)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns the string representation of the object
|
178
|
+
# @return [String] String presentation of the object
|
179
|
+
def to_s
|
180
|
+
to_hash.to_s
|
181
|
+
end
|
182
|
+
|
183
|
+
# to_body is an alias to to_hash (backward compatibility)
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_body
|
186
|
+
to_hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns the object in the form of hash
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_hash
|
192
|
+
hash = {}
|
193
|
+
self.class.attribute_map.each_pair do |attr, param|
|
194
|
+
value = self.send(attr)
|
195
|
+
next if value.nil?
|
196
|
+
hash[param] = _to_hash(value)
|
197
|
+
end
|
198
|
+
hash
|
199
|
+
end
|
200
|
+
|
201
|
+
# Outputs non-array value in the form of hash
|
202
|
+
# For object, use to_hash. Otherwise, just return the value
|
203
|
+
# @param [Object] value Any valid value
|
204
|
+
# @return [Hash] Returns the value in the form of hash
|
205
|
+
def _to_hash(value)
|
206
|
+
if value.is_a?(Array)
|
207
|
+
value.compact.map{ |v| _to_hash(v) }
|
208
|
+
elsif value.is_a?(Hash)
|
209
|
+
{}.tap do |hash|
|
210
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
211
|
+
end
|
212
|
+
elsif value.respond_to? :to_hash
|
213
|
+
value.to_hash
|
214
|
+
else
|
215
|
+
value
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
@@ -0,0 +1,227 @@
|
|
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: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveImageRecognitionApiClient
|
16
|
+
# Request to draw one or more polygons on a base image
|
17
|
+
class DrawPolygonRequest
|
18
|
+
# Image to draw polygons on, in bytes. You can also use the BaseImageUrl instead to supply image input as a URL
|
19
|
+
attr_accessor :base_image_bytes
|
20
|
+
|
21
|
+
# Image to draw polygons on, as an HTTP or HTTPS fully-qualified URL
|
22
|
+
attr_accessor :base_image_url
|
23
|
+
|
24
|
+
# Polygons to draw on the image. Polygons are drawn in index order.
|
25
|
+
attr_accessor :polygons_to_draw
|
26
|
+
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'base_image_bytes' => :'BaseImageBytes',
|
32
|
+
:'base_image_url' => :'BaseImageUrl',
|
33
|
+
:'polygons_to_draw' => :'PolygonsToDraw'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'base_image_bytes' => :'String',
|
41
|
+
:'base_image_url' => :'String',
|
42
|
+
:'polygons_to_draw' => :'Array<DrawPolygonInstance>'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
return unless attributes.is_a?(Hash)
|
50
|
+
|
51
|
+
# convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
53
|
+
|
54
|
+
if attributes.has_key?(:'BaseImageBytes')
|
55
|
+
self.base_image_bytes = attributes[:'BaseImageBytes']
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes.has_key?(:'BaseImageUrl')
|
59
|
+
self.base_image_url = attributes[:'BaseImageUrl']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'PolygonsToDraw')
|
63
|
+
if (value = attributes[:'PolygonsToDraw']).is_a?(Array)
|
64
|
+
self.polygons_to_draw = value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properties with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
if !@base_image_bytes.nil? && @base_image_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
75
|
+
invalid_properties.push("invalid value for 'base_image_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
|
76
|
+
end
|
77
|
+
|
78
|
+
return invalid_properties
|
79
|
+
end
|
80
|
+
|
81
|
+
# Check to see if the all the properties in the model are valid
|
82
|
+
# @return true if the model is valid
|
83
|
+
def valid?
|
84
|
+
return false if !@base_image_bytes.nil? && @base_image_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
85
|
+
return true
|
86
|
+
end
|
87
|
+
|
88
|
+
# Custom attribute writer method with validation
|
89
|
+
# @param [Object] base_image_bytes Value to be assigned
|
90
|
+
def base_image_bytes=(base_image_bytes)
|
91
|
+
|
92
|
+
if !base_image_bytes.nil? && base_image_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
93
|
+
fail ArgumentError, "invalid value for 'base_image_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
|
94
|
+
end
|
95
|
+
|
96
|
+
@base_image_bytes = base_image_bytes
|
97
|
+
end
|
98
|
+
|
99
|
+
# Checks equality by comparing each attribute.
|
100
|
+
# @param [Object] Object to be compared
|
101
|
+
def ==(o)
|
102
|
+
return true if self.equal?(o)
|
103
|
+
self.class == o.class &&
|
104
|
+
base_image_bytes == o.base_image_bytes &&
|
105
|
+
base_image_url == o.base_image_url &&
|
106
|
+
polygons_to_draw == o.polygons_to_draw
|
107
|
+
end
|
108
|
+
|
109
|
+
# @see the `==` method
|
110
|
+
# @param [Object] Object to be compared
|
111
|
+
def eql?(o)
|
112
|
+
self == o
|
113
|
+
end
|
114
|
+
|
115
|
+
# Calculates hash code according to all attributes.
|
116
|
+
# @return [Fixnum] Hash code
|
117
|
+
def hash
|
118
|
+
[base_image_bytes, base_image_url, polygons_to_draw].hash
|
119
|
+
end
|
120
|
+
|
121
|
+
# Builds the object from hash
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
123
|
+
# @return [Object] Returns the model itself
|
124
|
+
def build_from_hash(attributes)
|
125
|
+
return nil unless attributes.is_a?(Hash)
|
126
|
+
self.class.swagger_types.each_pair do |key, type|
|
127
|
+
if type =~ /\AArray<(.*)>/i
|
128
|
+
# check to ensure the input is an array given that the the attribute
|
129
|
+
# is documented as an array but the input is not
|
130
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
131
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
132
|
+
end
|
133
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
134
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
135
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
136
|
+
end
|
137
|
+
|
138
|
+
self
|
139
|
+
end
|
140
|
+
|
141
|
+
# Deserializes the data based on type
|
142
|
+
# @param string type Data type
|
143
|
+
# @param string value Value to be deserialized
|
144
|
+
# @return [Object] Deserialized data
|
145
|
+
def _deserialize(type, value)
|
146
|
+
case type.to_sym
|
147
|
+
when :DateTime
|
148
|
+
DateTime.parse(value)
|
149
|
+
when :Date
|
150
|
+
Date.parse(value)
|
151
|
+
when :String
|
152
|
+
value.to_s
|
153
|
+
when :Integer
|
154
|
+
value.to_i
|
155
|
+
when :Float
|
156
|
+
value.to_f
|
157
|
+
when :BOOLEAN
|
158
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
159
|
+
true
|
160
|
+
else
|
161
|
+
false
|
162
|
+
end
|
163
|
+
when :Object
|
164
|
+
# generic object (usually a Hash), return directly
|
165
|
+
value
|
166
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
167
|
+
inner_type = Regexp.last_match[:inner_type]
|
168
|
+
value.map { |v| _deserialize(inner_type, v) }
|
169
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
170
|
+
k_type = Regexp.last_match[:k_type]
|
171
|
+
v_type = Regexp.last_match[:v_type]
|
172
|
+
{}.tap do |hash|
|
173
|
+
value.each do |k, v|
|
174
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
else # model
|
178
|
+
temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
|
179
|
+
temp_model.build_from_hash(value)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the string representation of the object
|
184
|
+
# @return [String] String presentation of the object
|
185
|
+
def to_s
|
186
|
+
to_hash.to_s
|
187
|
+
end
|
188
|
+
|
189
|
+
# to_body is an alias to to_hash (backward compatibility)
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_body
|
192
|
+
to_hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Returns the object in the form of hash
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
197
|
+
def to_hash
|
198
|
+
hash = {}
|
199
|
+
self.class.attribute_map.each_pair do |attr, param|
|
200
|
+
value = self.send(attr)
|
201
|
+
next if value.nil?
|
202
|
+
hash[param] = _to_hash(value)
|
203
|
+
end
|
204
|
+
hash
|
205
|
+
end
|
206
|
+
|
207
|
+
# Outputs non-array value in the form of hash
|
208
|
+
# For object, use to_hash. Otherwise, just return the value
|
209
|
+
# @param [Object] value Any valid value
|
210
|
+
# @return [Hash] Returns the value in the form of hash
|
211
|
+
def _to_hash(value)
|
212
|
+
if value.is_a?(Array)
|
213
|
+
value.compact.map{ |v| _to_hash(v) }
|
214
|
+
elsif value.is_a?(Hash)
|
215
|
+
{}.tap do |hash|
|
216
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
217
|
+
end
|
218
|
+
elsif value.respond_to? :to_hash
|
219
|
+
value.to_hash
|
220
|
+
else
|
221
|
+
value
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
@@ -0,0 +1,199 @@
|
|
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: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveImageRecognitionApiClient
|
16
|
+
# One point in a polygon
|
17
|
+
class PolygonPoint
|
18
|
+
# X location in pixels of this point in the polygon
|
19
|
+
attr_accessor :x
|
20
|
+
|
21
|
+
# Y location in pixels of this point in the polygon
|
22
|
+
attr_accessor :y
|
23
|
+
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'x' => :'X',
|
29
|
+
:'y' => :'Y'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.swagger_types
|
35
|
+
{
|
36
|
+
:'x' => :'Float',
|
37
|
+
:'y' => :'Float'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Initializes the object
|
42
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
43
|
+
def initialize(attributes = {})
|
44
|
+
return unless attributes.is_a?(Hash)
|
45
|
+
|
46
|
+
# convert string to symbol for hash key
|
47
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
48
|
+
|
49
|
+
if attributes.has_key?(:'X')
|
50
|
+
self.x = attributes[:'X']
|
51
|
+
end
|
52
|
+
|
53
|
+
if attributes.has_key?(:'Y')
|
54
|
+
self.y = attributes[:'Y']
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
60
|
+
# @return Array for valid properties with the reasons
|
61
|
+
def list_invalid_properties
|
62
|
+
invalid_properties = Array.new
|
63
|
+
return invalid_properties
|
64
|
+
end
|
65
|
+
|
66
|
+
# Check to see if the all the properties in the model are valid
|
67
|
+
# @return true if the model is valid
|
68
|
+
def valid?
|
69
|
+
return true
|
70
|
+
end
|
71
|
+
|
72
|
+
# Checks equality by comparing each attribute.
|
73
|
+
# @param [Object] Object to be compared
|
74
|
+
def ==(o)
|
75
|
+
return true if self.equal?(o)
|
76
|
+
self.class == o.class &&
|
77
|
+
x == o.x &&
|
78
|
+
y == o.y
|
79
|
+
end
|
80
|
+
|
81
|
+
# @see the `==` method
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def eql?(o)
|
84
|
+
self == o
|
85
|
+
end
|
86
|
+
|
87
|
+
# Calculates hash code according to all attributes.
|
88
|
+
# @return [Fixnum] Hash code
|
89
|
+
def hash
|
90
|
+
[x, y].hash
|
91
|
+
end
|
92
|
+
|
93
|
+
# Builds the object from hash
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
# @return [Object] Returns the model itself
|
96
|
+
def build_from_hash(attributes)
|
97
|
+
return nil unless attributes.is_a?(Hash)
|
98
|
+
self.class.swagger_types.each_pair do |key, type|
|
99
|
+
if type =~ /\AArray<(.*)>/i
|
100
|
+
# check to ensure the input is an array given that the the attribute
|
101
|
+
# is documented as an array but the input is not
|
102
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
103
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
104
|
+
end
|
105
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
106
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
107
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
108
|
+
end
|
109
|
+
|
110
|
+
self
|
111
|
+
end
|
112
|
+
|
113
|
+
# Deserializes the data based on type
|
114
|
+
# @param string type Data type
|
115
|
+
# @param string value Value to be deserialized
|
116
|
+
# @return [Object] Deserialized data
|
117
|
+
def _deserialize(type, value)
|
118
|
+
case type.to_sym
|
119
|
+
when :DateTime
|
120
|
+
DateTime.parse(value)
|
121
|
+
when :Date
|
122
|
+
Date.parse(value)
|
123
|
+
when :String
|
124
|
+
value.to_s
|
125
|
+
when :Integer
|
126
|
+
value.to_i
|
127
|
+
when :Float
|
128
|
+
value.to_f
|
129
|
+
when :BOOLEAN
|
130
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
131
|
+
true
|
132
|
+
else
|
133
|
+
false
|
134
|
+
end
|
135
|
+
when :Object
|
136
|
+
# generic object (usually a Hash), return directly
|
137
|
+
value
|
138
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
139
|
+
inner_type = Regexp.last_match[:inner_type]
|
140
|
+
value.map { |v| _deserialize(inner_type, v) }
|
141
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
142
|
+
k_type = Regexp.last_match[:k_type]
|
143
|
+
v_type = Regexp.last_match[:v_type]
|
144
|
+
{}.tap do |hash|
|
145
|
+
value.each do |k, v|
|
146
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
else # model
|
150
|
+
temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
|
151
|
+
temp_model.build_from_hash(value)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns the string representation of the object
|
156
|
+
# @return [String] String presentation of the object
|
157
|
+
def to_s
|
158
|
+
to_hash.to_s
|
159
|
+
end
|
160
|
+
|
161
|
+
# to_body is an alias to to_hash (backward compatibility)
|
162
|
+
# @return [Hash] Returns the object in the form of hash
|
163
|
+
def to_body
|
164
|
+
to_hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Returns the object in the form of hash
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_hash
|
170
|
+
hash = {}
|
171
|
+
self.class.attribute_map.each_pair do |attr, param|
|
172
|
+
value = self.send(attr)
|
173
|
+
next if value.nil?
|
174
|
+
hash[param] = _to_hash(value)
|
175
|
+
end
|
176
|
+
hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Outputs non-array value in the form of hash
|
180
|
+
# For object, use to_hash. Otherwise, just return the value
|
181
|
+
# @param [Object] value Any valid value
|
182
|
+
# @return [Hash] Returns the value in the form of hash
|
183
|
+
def _to_hash(value)
|
184
|
+
if value.is_a?(Array)
|
185
|
+
value.compact.map{ |v| _to_hash(v) }
|
186
|
+
elsif value.is_a?(Hash)
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
189
|
+
end
|
190
|
+
elsif value.respond_to? :to_hash
|
191
|
+
value.to_hash
|
192
|
+
else
|
193
|
+
value
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
|
199
|
+
end
|
data/spec/api/edit_api_spec.rb
CHANGED
@@ -71,6 +71,18 @@ describe 'EditApi' do
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
+
# unit tests for edit_draw_polygon
|
75
|
+
# Draw polygon onto an image
|
76
|
+
# Draw one or more polygons, with customized visuals, onto an image
|
77
|
+
# @param request
|
78
|
+
# @param [Hash] opts the optional parameters
|
79
|
+
# @return [Object]
|
80
|
+
describe 'edit_draw_polygon test' do
|
81
|
+
it "should work" do
|
82
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
74
86
|
# unit tests for edit_draw_rectangle
|
75
87
|
# Draw rectangle onto an image
|
76
88
|
# Draw one or more rectangles, with customized visuals, onto an image
|
@@ -95,4 +107,16 @@ describe 'EditApi' do
|
|
95
107
|
end
|
96
108
|
end
|
97
109
|
|
110
|
+
# unit tests for edit_rotate
|
111
|
+
# Rotate an image any number of degrees
|
112
|
+
# Rotates an image by an arbitrary number of degrees
|
113
|
+
# @param degrees Degrees to rotate the image; values range from 0.0 to 360.0.
|
114
|
+
# @param [Hash] opts the optional parameters
|
115
|
+
# @return [Object]
|
116
|
+
describe 'edit_rotate test' do
|
117
|
+
it "should work" do
|
118
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
98
122
|
end
|
@@ -0,0 +1,60 @@
|
|
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: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for CloudmersiveImageRecognitionApiClient::DrawPolygonInstance
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'DrawPolygonInstance' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveImageRecognitionApiClient::DrawPolygonInstance.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of DrawPolygonInstance' do
|
31
|
+
it 'should create an instance of DrawPolygonInstance' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveImageRecognitionApiClient::DrawPolygonInstance)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "border_color"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'test attribute "border_width"' 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
|
+
describe 'test attribute "fill_color"' do
|
48
|
+
it 'should work' do
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'test attribute "points"' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
@@ -0,0 +1,54 @@
|
|
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: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for CloudmersiveImageRecognitionApiClient::DrawPolygonRequest
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'DrawPolygonRequest' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveImageRecognitionApiClient::DrawPolygonRequest.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of DrawPolygonRequest' do
|
31
|
+
it 'should create an instance of DrawPolygonRequest' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveImageRecognitionApiClient::DrawPolygonRequest)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "base_image_bytes"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'test attribute "base_image_url"' 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
|
+
describe 'test attribute "polygons_to_draw"' do
|
48
|
+
it 'should work' do
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
@@ -0,0 +1,48 @@
|
|
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: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for CloudmersiveImageRecognitionApiClient::PolygonPoint
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'PolygonPoint' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveImageRecognitionApiClient::PolygonPoint.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of PolygonPoint' do
|
31
|
+
it 'should create an instance of PolygonPoint' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveImageRecognitionApiClient::PolygonPoint)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "x"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'test attribute "y"' 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
|
48
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudmersive-image-recognition-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloudmersive
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -207,6 +207,8 @@ files:
|
|
207
207
|
- "./docs/ArtisticApi.md"
|
208
208
|
- "./docs/DetectedLicensePlate.md"
|
209
209
|
- "./docs/DetectedObject.md"
|
210
|
+
- "./docs/DrawPolygonInstance.md"
|
211
|
+
- "./docs/DrawPolygonRequest.md"
|
210
212
|
- "./docs/DrawRectangleInstance.md"
|
211
213
|
- "./docs/DrawRectangleRequest.md"
|
212
214
|
- "./docs/DrawTextInstance.md"
|
@@ -227,6 +229,7 @@ files:
|
|
227
229
|
- "./docs/NsfwResult.md"
|
228
230
|
- "./docs/ObjectDetectionResult.md"
|
229
231
|
- "./docs/PersonWithAge.md"
|
232
|
+
- "./docs/PolygonPoint.md"
|
230
233
|
- "./docs/RecognitionOutcome.md"
|
231
234
|
- "./docs/RecognizeApi.md"
|
232
235
|
- "./docs/ResizeApi.md"
|
@@ -247,6 +250,8 @@ files:
|
|
247
250
|
- "./lib/cloudmersive-image-recognition-api-client/models/age_detection_result.rb"
|
248
251
|
- "./lib/cloudmersive-image-recognition-api-client/models/detected_license_plate.rb"
|
249
252
|
- "./lib/cloudmersive-image-recognition-api-client/models/detected_object.rb"
|
253
|
+
- "./lib/cloudmersive-image-recognition-api-client/models/draw_polygon_instance.rb"
|
254
|
+
- "./lib/cloudmersive-image-recognition-api-client/models/draw_polygon_request.rb"
|
250
255
|
- "./lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_instance.rb"
|
251
256
|
- "./lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_request.rb"
|
252
257
|
- "./lib/cloudmersive-image-recognition-api-client/models/draw_text_instance.rb"
|
@@ -264,6 +269,7 @@ files:
|
|
264
269
|
- "./lib/cloudmersive-image-recognition-api-client/models/nsfw_result.rb"
|
265
270
|
- "./lib/cloudmersive-image-recognition-api-client/models/object_detection_result.rb"
|
266
271
|
- "./lib/cloudmersive-image-recognition-api-client/models/person_with_age.rb"
|
272
|
+
- "./lib/cloudmersive-image-recognition-api-client/models/polygon_point.rb"
|
267
273
|
- "./lib/cloudmersive-image-recognition-api-client/models/recognition_outcome.rb"
|
268
274
|
- "./lib/cloudmersive-image-recognition-api-client/models/text_detection_result.rb"
|
269
275
|
- "./lib/cloudmersive-image-recognition-api-client/models/text_item.rb"
|
@@ -280,6 +286,8 @@ files:
|
|
280
286
|
- "./spec/models/age_detection_result_spec.rb"
|
281
287
|
- "./spec/models/detected_license_plate_spec.rb"
|
282
288
|
- "./spec/models/detected_object_spec.rb"
|
289
|
+
- "./spec/models/draw_polygon_instance_spec.rb"
|
290
|
+
- "./spec/models/draw_polygon_request_spec.rb"
|
283
291
|
- "./spec/models/draw_rectangle_instance_spec.rb"
|
284
292
|
- "./spec/models/draw_rectangle_request_spec.rb"
|
285
293
|
- "./spec/models/draw_text_instance_spec.rb"
|
@@ -297,6 +305,7 @@ files:
|
|
297
305
|
- "./spec/models/nsfw_result_spec.rb"
|
298
306
|
- "./spec/models/object_detection_result_spec.rb"
|
299
307
|
- "./spec/models/person_with_age_spec.rb"
|
308
|
+
- "./spec/models/polygon_point_spec.rb"
|
300
309
|
- "./spec/models/recognition_outcome_spec.rb"
|
301
310
|
- "./spec/models/text_detection_result_spec.rb"
|
302
311
|
- "./spec/models/text_item_spec.rb"
|