cloudmersive-image-recognition-api-client 1.3.7 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -5
- data/cloudmersive-image-recognition-api-client.gemspec +1 -1
- data/docs/ColorResult.md +10 -0
- data/docs/DetectedLicensePlate.md +4 -4
- data/docs/DominantColorResult.md +9 -0
- data/docs/EditApi.md +134 -0
- data/docs/FaceApi.md +55 -0
- data/docs/FaceCompareResponse.md +1 -1
- data/docs/FaceLocateWithLandmarksResponse.md +1 -1
- data/docs/FaceWithLandmarks.md +9 -9
- data/docs/FilterApi.md +475 -0
- data/docs/FindSymbolResult.md +12 -0
- data/docs/GenderDetectionResult.md +10 -0
- data/docs/InfoApi.md +63 -0
- data/docs/PersonWithAge.md +1 -0
- data/docs/PersonWithGender.md +10 -0
- data/docs/RecognizeApi.md +68 -4
- data/docs/ResizeApi.md +64 -3
- data/lib/cloudmersive-image-recognition-api-client.rb +8 -1
- data/lib/cloudmersive-image-recognition-api-client/api/artistic_api.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/api/edit_api.rb +161 -1
- data/lib/cloudmersive-image-recognition-api-client/api/face_api.rb +57 -1
- data/lib/cloudmersive-image-recognition-api-client/api/filter_api.rb +524 -0
- data/lib/cloudmersive-image-recognition-api-client/api/info_api.rb +79 -0
- data/lib/cloudmersive-image-recognition-api-client/api/nsfw_api.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb +76 -4
- data/lib/cloudmersive-image-recognition-api-client/api/resize_api.rb +71 -3
- data/lib/cloudmersive-image-recognition-api-client/api_client.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/api_error.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/configuration.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/age_detection_result.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/color_result.rb +209 -0
- data/lib/cloudmersive-image-recognition-api-client/models/detected_license_plate.rb +26 -22
- data/lib/cloudmersive-image-recognition-api-client/models/detected_object.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/dominant_color_result.rb +201 -0
- data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_instance.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_request.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_instance.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_request.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/draw_text_instance.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/draw_text_request.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/face.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/face_compare_response.rb +15 -14
- data/lib/cloudmersive-image-recognition-api-client/models/face_locate_response.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/face_locate_with_landmarks_response.rb +15 -14
- data/lib/cloudmersive-image-recognition-api-client/models/face_match.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/face_point.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/face_with_landmarks.rb +54 -45
- data/lib/cloudmersive-image-recognition-api-client/models/find_symbol_result.rb +229 -0
- data/lib/cloudmersive-image-recognition-api-client/models/fine_text_detection_result.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/fine_text_item.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/gender_detection_result.rb +211 -0
- data/lib/cloudmersive-image-recognition-api-client/models/image_description_response.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/nsfw_result.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/object_detection_result.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/person_with_age.rb +14 -5
- data/lib/cloudmersive-image-recognition-api-client/models/person_with_gender.rb +209 -0
- data/lib/cloudmersive-image-recognition-api-client/models/polygon_point.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/recognition_outcome.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/text_detection_result.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/text_item.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/models/vehicle_license_plate_detection_result.rb +1 -1
- data/lib/cloudmersive-image-recognition-api-client/version.rb +2 -2
- data/spec/api/artistic_api_spec.rb +1 -1
- data/spec/api/edit_api_spec.rb +33 -1
- data/spec/api/face_api_spec.rb +13 -1
- data/spec/api/filter_api_spec.rb +140 -0
- data/spec/api/info_api_spec.rb +47 -0
- data/spec/api/nsfw_api_spec.rb +1 -1
- data/spec/api/recognize_api_spec.rb +15 -1
- data/spec/api/resize_api_spec.rb +16 -2
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/age_detection_result_spec.rb +1 -1
- data/spec/models/color_result_spec.rb +54 -0
- data/spec/models/detected_license_plate_spec.rb +7 -7
- data/spec/models/detected_object_spec.rb +1 -1
- data/spec/models/dominant_color_result_spec.rb +48 -0
- data/spec/models/draw_polygon_instance_spec.rb +1 -1
- data/spec/models/draw_polygon_request_spec.rb +1 -1
- data/spec/models/draw_rectangle_instance_spec.rb +1 -1
- data/spec/models/draw_rectangle_request_spec.rb +1 -1
- data/spec/models/draw_text_instance_spec.rb +1 -1
- data/spec/models/draw_text_request_spec.rb +1 -1
- data/spec/models/face_compare_response_spec.rb +5 -5
- data/spec/models/face_locate_response_spec.rb +1 -1
- data/spec/models/face_locate_with_landmarks_response_spec.rb +5 -5
- data/spec/models/face_match_spec.rb +1 -1
- data/spec/models/face_point_spec.rb +1 -1
- data/spec/models/face_spec.rb +1 -1
- data/spec/models/face_with_landmarks_spec.rb +14 -14
- data/spec/models/find_symbol_result_spec.rb +66 -0
- data/spec/models/fine_text_detection_result_spec.rb +1 -1
- data/spec/models/fine_text_item_spec.rb +1 -1
- data/spec/models/gender_detection_result_spec.rb +54 -0
- data/spec/models/image_description_response_spec.rb +1 -1
- data/spec/models/nsfw_result_spec.rb +1 -1
- data/spec/models/object_detection_result_spec.rb +1 -1
- data/spec/models/person_with_age_spec.rb +7 -1
- data/spec/models/person_with_gender_spec.rb +54 -0
- data/spec/models/polygon_point_spec.rb +1 -1
- data/spec/models/recognition_outcome_spec.rb +1 -1
- data/spec/models/text_detection_result_spec.rb +1 -1
- data/spec/models/text_item_spec.rb +1 -1
- data/spec/models/vehicle_license_plate_detection_result_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +36 -16
@@ -0,0 +1,79 @@
|
|
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 "uri"
|
14
|
+
|
15
|
+
module CloudmersiveImageRecognitionApiClient
|
16
|
+
class InfoApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns the dominant colors of the image
|
24
|
+
# 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.
|
25
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @return [DominantColorResult]
|
28
|
+
def info_get_dominant_color(image_file, opts = {})
|
29
|
+
data, _status_code, _headers = info_get_dominant_color_with_http_info(image_file, opts)
|
30
|
+
return data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns the dominant colors of the image
|
34
|
+
# 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.
|
35
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
36
|
+
# @param [Hash] opts the optional parameters
|
37
|
+
# @return [Array<(DominantColorResult, Fixnum, Hash)>] DominantColorResult data, response status code and response headers
|
38
|
+
def info_get_dominant_color_with_http_info(image_file, opts = {})
|
39
|
+
if @api_client.config.debugging
|
40
|
+
@api_client.config.logger.debug "Calling API: InfoApi.info_get_dominant_color ..."
|
41
|
+
end
|
42
|
+
# verify the required parameter 'image_file' is set
|
43
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
44
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling InfoApi.info_get_dominant_color"
|
45
|
+
end
|
46
|
+
# resource path
|
47
|
+
local_var_path = "/image/get-info/dominant-color"
|
48
|
+
|
49
|
+
# query parameters
|
50
|
+
query_params = {}
|
51
|
+
|
52
|
+
# header parameters
|
53
|
+
header_params = {}
|
54
|
+
# HTTP header 'Accept' (if needed)
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
56
|
+
# HTTP header 'Content-Type'
|
57
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
58
|
+
|
59
|
+
# form parameters
|
60
|
+
form_params = {}
|
61
|
+
form_params["imageFile"] = image_file
|
62
|
+
|
63
|
+
# http body (model)
|
64
|
+
post_body = nil
|
65
|
+
auth_names = ['Apikey']
|
66
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
67
|
+
:header_params => header_params,
|
68
|
+
:query_params => query_params,
|
69
|
+
:form_params => form_params,
|
70
|
+
:body => post_body,
|
71
|
+
:auth_names => auth_names,
|
72
|
+
:return_type => 'DominantColorResult')
|
73
|
+
if @api_client.config.debugging
|
74
|
+
@api_client.config.logger.debug "API called: InfoApi#info_get_dominant_color\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
75
|
+
end
|
76
|
+
return data, status_code, headers
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -305,21 +305,27 @@ module CloudmersiveImageRecognitionApiClient
|
|
305
305
|
|
306
306
|
# Detect large text in a photo
|
307
307
|
# 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.
|
308
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
308
309
|
# @param [Hash] opts the optional parameters
|
309
310
|
# @return [TextDetectionResult]
|
310
|
-
def recognize_detect_text_large(opts = {})
|
311
|
-
data, _status_code, _headers = recognize_detect_text_large_with_http_info(opts)
|
311
|
+
def recognize_detect_text_large(image_file, opts = {})
|
312
|
+
data, _status_code, _headers = recognize_detect_text_large_with_http_info(image_file, opts)
|
312
313
|
return data
|
313
314
|
end
|
314
315
|
|
315
316
|
# Detect large text in a photo
|
316
317
|
# 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.
|
318
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
317
319
|
# @param [Hash] opts the optional parameters
|
318
320
|
# @return [Array<(TextDetectionResult, Fixnum, Hash)>] TextDetectionResult data, response status code and response headers
|
319
|
-
def recognize_detect_text_large_with_http_info(opts = {})
|
321
|
+
def recognize_detect_text_large_with_http_info(image_file, opts = {})
|
320
322
|
if @api_client.config.debugging
|
321
323
|
@api_client.config.logger.debug "Calling API: RecognizeApi.recognize_detect_text_large ..."
|
322
324
|
end
|
325
|
+
# verify the required parameter 'image_file' is set
|
326
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
327
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_text_large"
|
328
|
+
end
|
323
329
|
# resource path
|
324
330
|
local_var_path = "/image/recognize/detect-text/large"
|
325
331
|
|
@@ -330,9 +336,12 @@ module CloudmersiveImageRecognitionApiClient
|
|
330
336
|
header_params = {}
|
331
337
|
# HTTP header 'Accept' (if needed)
|
332
338
|
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
339
|
+
# HTTP header 'Content-Type'
|
340
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
333
341
|
|
334
342
|
# form parameters
|
335
343
|
form_params = {}
|
344
|
+
form_params["imageFile"] = image_file
|
336
345
|
|
337
346
|
# http body (model)
|
338
347
|
post_body = nil
|
@@ -405,5 +414,68 @@ module CloudmersiveImageRecognitionApiClient
|
|
405
414
|
end
|
406
415
|
return data, status_code, headers
|
407
416
|
end
|
417
|
+
|
418
|
+
# Find the location of a symbol in an image
|
419
|
+
# Determine if an image contains a symbol, and if so, the location of that symbol in the image.
|
420
|
+
# @param input_image Image file to search through for the target image.
|
421
|
+
# @param target_image Image to find in the input image.
|
422
|
+
# @param [Hash] opts the optional parameters
|
423
|
+
# @return [FindSymbolResult]
|
424
|
+
def recognize_find_symbol(input_image, target_image, opts = {})
|
425
|
+
data, _status_code, _headers = recognize_find_symbol_with_http_info(input_image, target_image, opts)
|
426
|
+
return data
|
427
|
+
end
|
428
|
+
|
429
|
+
# Find the location of a symbol in an image
|
430
|
+
# Determine if an image contains a symbol, and if so, the location of that symbol in the image.
|
431
|
+
# @param input_image Image file to search through for the target image.
|
432
|
+
# @param target_image Image to find in the input image.
|
433
|
+
# @param [Hash] opts the optional parameters
|
434
|
+
# @return [Array<(FindSymbolResult, Fixnum, Hash)>] FindSymbolResult data, response status code and response headers
|
435
|
+
def recognize_find_symbol_with_http_info(input_image, target_image, opts = {})
|
436
|
+
if @api_client.config.debugging
|
437
|
+
@api_client.config.logger.debug "Calling API: RecognizeApi.recognize_find_symbol ..."
|
438
|
+
end
|
439
|
+
# verify the required parameter 'input_image' is set
|
440
|
+
if @api_client.config.client_side_validation && input_image.nil?
|
441
|
+
fail ArgumentError, "Missing the required parameter 'input_image' when calling RecognizeApi.recognize_find_symbol"
|
442
|
+
end
|
443
|
+
# verify the required parameter 'target_image' is set
|
444
|
+
if @api_client.config.client_side_validation && target_image.nil?
|
445
|
+
fail ArgumentError, "Missing the required parameter 'target_image' when calling RecognizeApi.recognize_find_symbol"
|
446
|
+
end
|
447
|
+
# resource path
|
448
|
+
local_var_path = "/image/recognize/find/symbol"
|
449
|
+
|
450
|
+
# query parameters
|
451
|
+
query_params = {}
|
452
|
+
|
453
|
+
# header parameters
|
454
|
+
header_params = {}
|
455
|
+
# HTTP header 'Accept' (if needed)
|
456
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
457
|
+
# HTTP header 'Content-Type'
|
458
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
459
|
+
|
460
|
+
# form parameters
|
461
|
+
form_params = {}
|
462
|
+
form_params["inputImage"] = input_image
|
463
|
+
form_params["targetImage"] = target_image
|
464
|
+
|
465
|
+
# http body (model)
|
466
|
+
post_body = nil
|
467
|
+
auth_names = ['Apikey']
|
468
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
469
|
+
:header_params => header_params,
|
470
|
+
:query_params => query_params,
|
471
|
+
:form_params => form_params,
|
472
|
+
:body => post_body,
|
473
|
+
:auth_names => auth_names,
|
474
|
+
:return_type => 'FindSymbolResult')
|
475
|
+
if @api_client.config.debugging
|
476
|
+
@api_client.config.logger.debug "API called: RecognizeApi#recognize_find_symbol\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
477
|
+
end
|
478
|
+
return data, status_code, headers
|
479
|
+
end
|
408
480
|
end
|
409
481
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -20,7 +20,7 @@ module CloudmersiveImageRecognitionApiClient
|
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
22
|
|
23
|
-
# Resize an image
|
23
|
+
# Resize an image while preserving aspect ratio
|
24
24
|
# Resize an image to a maximum width and maximum height, while preserving the image's original aspect ratio
|
25
25
|
# @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
|
26
26
|
# @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
|
@@ -32,7 +32,7 @@ module CloudmersiveImageRecognitionApiClient
|
|
32
32
|
return data
|
33
33
|
end
|
34
34
|
|
35
|
-
# Resize an image
|
35
|
+
# Resize an image while preserving aspect ratio
|
36
36
|
# Resize an image to a maximum width and maximum height, while preserving the image's original aspect ratio
|
37
37
|
# @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
|
38
38
|
# @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
|
@@ -87,5 +87,73 @@ module CloudmersiveImageRecognitionApiClient
|
|
87
87
|
end
|
88
88
|
return data, status_code, headers
|
89
89
|
end
|
90
|
+
|
91
|
+
# Resize an image
|
92
|
+
# Resize an image to a specific width and specific height
|
93
|
+
# @param width
|
94
|
+
# @param height
|
95
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
96
|
+
# @param [Hash] opts the optional parameters
|
97
|
+
# @return [String]
|
98
|
+
def resize_resize_simple(width, height, image_file, opts = {})
|
99
|
+
data, _status_code, _headers = resize_resize_simple_with_http_info(width, height, image_file, opts)
|
100
|
+
return data
|
101
|
+
end
|
102
|
+
|
103
|
+
# Resize an image
|
104
|
+
# Resize an image to a specific width and specific height
|
105
|
+
# @param width
|
106
|
+
# @param height
|
107
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
108
|
+
# @param [Hash] opts the optional parameters
|
109
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
110
|
+
def resize_resize_simple_with_http_info(width, height, image_file, opts = {})
|
111
|
+
if @api_client.config.debugging
|
112
|
+
@api_client.config.logger.debug "Calling API: ResizeApi.resize_resize_simple ..."
|
113
|
+
end
|
114
|
+
# verify the required parameter 'width' is set
|
115
|
+
if @api_client.config.client_side_validation && width.nil?
|
116
|
+
fail ArgumentError, "Missing the required parameter 'width' when calling ResizeApi.resize_resize_simple"
|
117
|
+
end
|
118
|
+
# verify the required parameter 'height' is set
|
119
|
+
if @api_client.config.client_side_validation && height.nil?
|
120
|
+
fail ArgumentError, "Missing the required parameter 'height' when calling ResizeApi.resize_resize_simple"
|
121
|
+
end
|
122
|
+
# verify the required parameter 'image_file' is set
|
123
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
124
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ResizeApi.resize_resize_simple"
|
125
|
+
end
|
126
|
+
# resource path
|
127
|
+
local_var_path = "/image/resize/target/{width}/{height}".sub('{' + 'width' + '}', width.to_s).sub('{' + 'height' + '}', height.to_s)
|
128
|
+
|
129
|
+
# query parameters
|
130
|
+
query_params = {}
|
131
|
+
|
132
|
+
# header parameters
|
133
|
+
header_params = {}
|
134
|
+
# HTTP header 'Accept' (if needed)
|
135
|
+
header_params['Accept'] = @api_client.select_header_accept(['image/png'])
|
136
|
+
# HTTP header 'Content-Type'
|
137
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
138
|
+
|
139
|
+
# form parameters
|
140
|
+
form_params = {}
|
141
|
+
form_params["imageFile"] = image_file
|
142
|
+
|
143
|
+
# http body (model)
|
144
|
+
post_body = nil
|
145
|
+
auth_names = ['Apikey']
|
146
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
147
|
+
:header_params => header_params,
|
148
|
+
:query_params => query_params,
|
149
|
+
:form_params => form_params,
|
150
|
+
:body => post_body,
|
151
|
+
:auth_names => auth_names,
|
152
|
+
:return_type => 'String')
|
153
|
+
if @api_client.config.debugging
|
154
|
+
@api_client.config.logger.debug "API called: ResizeApi#resize_resize_simple\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
155
|
+
end
|
156
|
+
return data, status_code, headers
|
157
|
+
end
|
90
158
|
end
|
91
159
|
end
|
@@ -0,0 +1,209 @@
|
|
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 'date'
|
14
|
+
|
15
|
+
module CloudmersiveImageRecognitionApiClient
|
16
|
+
# Individual color
|
17
|
+
class ColorResult
|
18
|
+
# Red (R) channel pixel value of this color
|
19
|
+
attr_accessor :r
|
20
|
+
|
21
|
+
# Green (G) channel pixel value of this color
|
22
|
+
attr_accessor :g
|
23
|
+
|
24
|
+
# Blue (B) channel pixel value of this color
|
25
|
+
attr_accessor :b
|
26
|
+
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'r' => :'R',
|
32
|
+
:'g' => :'G',
|
33
|
+
:'b' => :'B'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'r' => :'Integer',
|
41
|
+
:'g' => :'Integer',
|
42
|
+
:'b' => :'Integer'
|
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?(:'R')
|
55
|
+
self.r = attributes[:'R']
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes.has_key?(:'G')
|
59
|
+
self.g = attributes[:'G']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'B')
|
63
|
+
self.b = attributes[:'B']
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
69
|
+
# @return Array for valid properties with the reasons
|
70
|
+
def list_invalid_properties
|
71
|
+
invalid_properties = Array.new
|
72
|
+
return invalid_properties
|
73
|
+
end
|
74
|
+
|
75
|
+
# Check to see if the all the properties in the model are valid
|
76
|
+
# @return true if the model is valid
|
77
|
+
def valid?
|
78
|
+
return true
|
79
|
+
end
|
80
|
+
|
81
|
+
# Checks equality by comparing each attribute.
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def ==(o)
|
84
|
+
return true if self.equal?(o)
|
85
|
+
self.class == o.class &&
|
86
|
+
r == o.r &&
|
87
|
+
g == o.g &&
|
88
|
+
b == o.b
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def eql?(o)
|
94
|
+
self == o
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculates hash code according to all attributes.
|
98
|
+
# @return [Fixnum] Hash code
|
99
|
+
def hash
|
100
|
+
[r, g, b].hash
|
101
|
+
end
|
102
|
+
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def build_from_hash(attributes)
|
107
|
+
return nil unless attributes.is_a?(Hash)
|
108
|
+
self.class.swagger_types.each_pair do |key, type|
|
109
|
+
if type =~ /\AArray<(.*)>/i
|
110
|
+
# check to ensure the input is an array given that the the attribute
|
111
|
+
# is documented as an array but the input is not
|
112
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
113
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
114
|
+
end
|
115
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
116
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
117
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
118
|
+
end
|
119
|
+
|
120
|
+
self
|
121
|
+
end
|
122
|
+
|
123
|
+
# Deserializes the data based on type
|
124
|
+
# @param string type Data type
|
125
|
+
# @param string value Value to be deserialized
|
126
|
+
# @return [Object] Deserialized data
|
127
|
+
def _deserialize(type, value)
|
128
|
+
case type.to_sym
|
129
|
+
when :DateTime
|
130
|
+
DateTime.parse(value)
|
131
|
+
when :Date
|
132
|
+
Date.parse(value)
|
133
|
+
when :String
|
134
|
+
value.to_s
|
135
|
+
when :Integer
|
136
|
+
value.to_i
|
137
|
+
when :Float
|
138
|
+
value.to_f
|
139
|
+
when :BOOLEAN
|
140
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
141
|
+
true
|
142
|
+
else
|
143
|
+
false
|
144
|
+
end
|
145
|
+
when :Object
|
146
|
+
# generic object (usually a Hash), return directly
|
147
|
+
value
|
148
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
149
|
+
inner_type = Regexp.last_match[:inner_type]
|
150
|
+
value.map { |v| _deserialize(inner_type, v) }
|
151
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
152
|
+
k_type = Regexp.last_match[:k_type]
|
153
|
+
v_type = Regexp.last_match[:v_type]
|
154
|
+
{}.tap do |hash|
|
155
|
+
value.each do |k, v|
|
156
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
else # model
|
160
|
+
temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
|
161
|
+
temp_model.build_from_hash(value)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
# Returns the string representation of the object
|
166
|
+
# @return [String] String presentation of the object
|
167
|
+
def to_s
|
168
|
+
to_hash.to_s
|
169
|
+
end
|
170
|
+
|
171
|
+
# to_body is an alias to to_hash (backward compatibility)
|
172
|
+
# @return [Hash] Returns the object in the form of hash
|
173
|
+
def to_body
|
174
|
+
to_hash
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns the object in the form of hash
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_hash
|
180
|
+
hash = {}
|
181
|
+
self.class.attribute_map.each_pair do |attr, param|
|
182
|
+
value = self.send(attr)
|
183
|
+
next if value.nil?
|
184
|
+
hash[param] = _to_hash(value)
|
185
|
+
end
|
186
|
+
hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Outputs non-array value in the form of hash
|
190
|
+
# For object, use to_hash. Otherwise, just return the value
|
191
|
+
# @param [Object] value Any valid value
|
192
|
+
# @return [Hash] Returns the value in the form of hash
|
193
|
+
def _to_hash(value)
|
194
|
+
if value.is_a?(Array)
|
195
|
+
value.compact.map{ |v| _to_hash(v) }
|
196
|
+
elsif value.is_a?(Hash)
|
197
|
+
{}.tap do |hash|
|
198
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
199
|
+
end
|
200
|
+
elsif value.respond_to? :to_hash
|
201
|
+
value.to_hash
|
202
|
+
else
|
203
|
+
value
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|