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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -0
  3. data/README.md +184 -0
  4. data/Rakefile +8 -0
  5. data/cloudmersive-image-recognition-api-client.gemspec +45 -0
  6. data/docs/AgeDetectionResult.md +10 -0
  7. data/docs/ArtisticApi.md +66 -0
  8. data/docs/ColorResult.md +10 -0
  9. data/docs/ConvertApi.md +396 -0
  10. data/docs/DetectedLicensePlate.md +14 -0
  11. data/docs/DetectedObject.md +13 -0
  12. data/docs/DominantColorResult.md +9 -0
  13. data/docs/DrawPolygonInstance.md +11 -0
  14. data/docs/DrawPolygonRequest.md +10 -0
  15. data/docs/DrawRectangleInstance.md +14 -0
  16. data/docs/DrawRectangleRequest.md +10 -0
  17. data/docs/DrawTextInstance.md +15 -0
  18. data/docs/DrawTextRequest.md +10 -0
  19. data/docs/EditApi.md +704 -0
  20. data/docs/Face.md +11 -0
  21. data/docs/FaceApi.md +396 -0
  22. data/docs/FaceCompareResponse.md +11 -0
  23. data/docs/FaceLocateResponse.md +11 -0
  24. data/docs/FaceLocateWithLandmarksResponse.md +11 -0
  25. data/docs/FaceMatch.md +13 -0
  26. data/docs/FacePoint.md +9 -0
  27. data/docs/FaceWithLandmarks.md +20 -0
  28. data/docs/FilterApi.md +478 -0
  29. data/docs/FindSymbolResult.md +13 -0
  30. data/docs/FineTextDetectionResult.md +10 -0
  31. data/docs/FineTextItem.md +18 -0
  32. data/docs/GenderDetectionResult.md +10 -0
  33. data/docs/ImageDescriptionResponse.md +11 -0
  34. data/docs/ImageMetadata.md +17 -0
  35. data/docs/ImageMetadataExifValue.md +10 -0
  36. data/docs/InfoApi.md +118 -0
  37. data/docs/NsfwApi.md +63 -0
  38. data/docs/NsfwResult.md +10 -0
  39. data/docs/ObjectDetectionResult.md +10 -0
  40. data/docs/PersonWithAge.md +11 -0
  41. data/docs/PersonWithGender.md +10 -0
  42. data/docs/PolygonPoint.md +9 -0
  43. data/docs/RecognitionOutcome.md +9 -0
  44. data/docs/RecognizeApi.md +455 -0
  45. data/docs/ResizeApi.md +130 -0
  46. data/docs/TextDetectionResult.md +10 -0
  47. data/docs/TextItem.md +11 -0
  48. data/docs/VehicleLicensePlateDetectionResult.md +10 -0
  49. data/git_push.sh +55 -0
  50. data/lib/cloudmersive-image-recognition-api-client.rb +82 -0
  51. data/lib/cloudmersive-image-recognition-api-client/api/artistic_api.rb +84 -0
  52. data/lib/cloudmersive-image-recognition-api-client/api/convert_api.rb +414 -0
  53. data/lib/cloudmersive-image-recognition-api-client/api/edit_api.rb +753 -0
  54. data/lib/cloudmersive-image-recognition-api-client/api/face_api.rb +415 -0
  55. data/lib/cloudmersive-image-recognition-api-client/api/filter_api.rb +525 -0
  56. data/lib/cloudmersive-image-recognition-api-client/api/info_api.rb +133 -0
  57. data/lib/cloudmersive-image-recognition-api-client/api/nsfw_api.rb +78 -0
  58. data/lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb +473 -0
  59. data/lib/cloudmersive-image-recognition-api-client/api/resize_api.rb +157 -0
  60. data/lib/cloudmersive-image-recognition-api-client/api_client.rb +391 -0
  61. data/lib/cloudmersive-image-recognition-api-client/api_error.rb +38 -0
  62. data/lib/cloudmersive-image-recognition-api-client/configuration.rb +209 -0
  63. data/lib/cloudmersive-image-recognition-api-client/models/age_detection_result.rb +208 -0
  64. data/lib/cloudmersive-image-recognition-api-client/models/color_result.rb +206 -0
  65. data/lib/cloudmersive-image-recognition-api-client/models/detected_license_plate.rb +246 -0
  66. data/lib/cloudmersive-image-recognition-api-client/models/detected_object.rb +236 -0
  67. data/lib/cloudmersive-image-recognition-api-client/models/dominant_color_result.rb +198 -0
  68. data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_instance.rb +218 -0
  69. data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_request.rb +223 -0
  70. data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_instance.rb +246 -0
  71. data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_request.rb +223 -0
  72. data/lib/cloudmersive-image-recognition-api-client/models/draw_text_instance.rb +256 -0
  73. data/lib/cloudmersive-image-recognition-api-client/models/draw_text_request.rb +223 -0
  74. data/lib/cloudmersive-image-recognition-api-client/models/face.rb +216 -0
  75. data/lib/cloudmersive-image-recognition-api-client/models/face_compare_response.rb +218 -0
  76. data/lib/cloudmersive-image-recognition-api-client/models/face_locate_response.rb +218 -0
  77. data/lib/cloudmersive-image-recognition-api-client/models/face_locate_with_landmarks_response.rb +218 -0
  78. data/lib/cloudmersive-image-recognition-api-client/models/face_match.rb +236 -0
  79. data/lib/cloudmersive-image-recognition-api-client/models/face_point.rb +196 -0
  80. data/lib/cloudmersive-image-recognition-api-client/models/face_with_landmarks.rb +324 -0
  81. data/lib/cloudmersive-image-recognition-api-client/models/find_symbol_result.rb +236 -0
  82. data/lib/cloudmersive-image-recognition-api-client/models/fine_text_detection_result.rb +208 -0
  83. data/lib/cloudmersive-image-recognition-api-client/models/fine_text_item.rb +286 -0
  84. data/lib/cloudmersive-image-recognition-api-client/models/gender_detection_result.rb +208 -0
  85. data/lib/cloudmersive-image-recognition-api-client/models/image_description_response.rb +216 -0
  86. data/lib/cloudmersive-image-recognition-api-client/models/image_metadata.rb +278 -0
  87. data/lib/cloudmersive-image-recognition-api-client/models/image_metadata_exif_value.rb +206 -0
  88. data/lib/cloudmersive-image-recognition-api-client/models/nsfw_result.rb +206 -0
  89. data/lib/cloudmersive-image-recognition-api-client/models/object_detection_result.rb +208 -0
  90. data/lib/cloudmersive-image-recognition-api-client/models/person_with_age.rb +215 -0
  91. data/lib/cloudmersive-image-recognition-api-client/models/person_with_gender.rb +206 -0
  92. data/lib/cloudmersive-image-recognition-api-client/models/polygon_point.rb +196 -0
  93. data/lib/cloudmersive-image-recognition-api-client/models/recognition_outcome.rb +196 -0
  94. data/lib/cloudmersive-image-recognition-api-client/models/text_detection_result.rb +208 -0
  95. data/lib/cloudmersive-image-recognition-api-client/models/text_item.rb +216 -0
  96. data/lib/cloudmersive-image-recognition-api-client/models/vehicle_license_plate_detection_result.rb +208 -0
  97. data/lib/cloudmersive-image-recognition-api-client/version.rb +15 -0
  98. data/spec/api/artistic_api_spec.rb +48 -0
  99. data/spec/api/convert_api_spec.rb +120 -0
  100. data/spec/api/edit_api_spec.rb +191 -0
  101. data/spec/api/face_api_spec.rb +120 -0
  102. data/spec/api/filter_api_spec.rb +141 -0
  103. data/spec/api/info_api_spec.rb +59 -0
  104. data/spec/api/nsfw_api_spec.rb +47 -0
  105. data/spec/api/recognize_api_spec.rb +133 -0
  106. data/spec/api/resize_api_spec.rb +63 -0
  107. data/spec/api_client_spec.rb +243 -0
  108. data/spec/configuration_spec.rb +42 -0
  109. data/spec/models/age_detection_result_spec.rb +53 -0
  110. data/spec/models/color_result_spec.rb +53 -0
  111. data/spec/models/detected_license_plate_spec.rb +77 -0
  112. data/spec/models/detected_object_spec.rb +71 -0
  113. data/spec/models/dominant_color_result_spec.rb +47 -0
  114. data/spec/models/draw_polygon_instance_spec.rb +59 -0
  115. data/spec/models/draw_polygon_request_spec.rb +53 -0
  116. data/spec/models/draw_rectangle_instance_spec.rb +77 -0
  117. data/spec/models/draw_rectangle_request_spec.rb +53 -0
  118. data/spec/models/draw_text_instance_spec.rb +83 -0
  119. data/spec/models/draw_text_request_spec.rb +53 -0
  120. data/spec/models/face_compare_response_spec.rb +59 -0
  121. data/spec/models/face_locate_response_spec.rb +59 -0
  122. data/spec/models/face_locate_with_landmarks_response_spec.rb +59 -0
  123. data/spec/models/face_match_spec.rb +71 -0
  124. data/spec/models/face_point_spec.rb +47 -0
  125. data/spec/models/face_spec.rb +59 -0
  126. data/spec/models/face_with_landmarks_spec.rb +113 -0
  127. data/spec/models/find_symbol_result_spec.rb +71 -0
  128. data/spec/models/fine_text_detection_result_spec.rb +53 -0
  129. data/spec/models/fine_text_item_spec.rb +101 -0
  130. data/spec/models/gender_detection_result_spec.rb +53 -0
  131. data/spec/models/image_description_response_spec.rb +59 -0
  132. data/spec/models/image_metadata_exif_value_spec.rb +53 -0
  133. data/spec/models/image_metadata_spec.rb +95 -0
  134. data/spec/models/nsfw_result_spec.rb +53 -0
  135. data/spec/models/object_detection_result_spec.rb +53 -0
  136. data/spec/models/person_with_age_spec.rb +59 -0
  137. data/spec/models/person_with_gender_spec.rb +53 -0
  138. data/spec/models/polygon_point_spec.rb +47 -0
  139. data/spec/models/recognition_outcome_spec.rb +47 -0
  140. data/spec/models/text_detection_result_spec.rb +53 -0
  141. data/spec/models/text_item_spec.rb +59 -0
  142. data/spec/models/vehicle_license_plate_detection_result_spec.rb +53 -0
  143. data/spec/spec_helper.rb +111 -0
  144. metadata +145 -3
@@ -0,0 +1,218 @@
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.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveImageRecognitionApiClient
16
+ # Results of locating faces in an image
17
+ class FaceLocateResponse
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Array of faces found in the image
22
+ attr_accessor :faces
23
+
24
+ # Number of faces found in the image
25
+ attr_accessor :face_count
26
+
27
+ # Details of any errors that occurred
28
+ attr_accessor :error_details
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'successful' => :'Successful',
34
+ :'faces' => :'Faces',
35
+ :'face_count' => :'FaceCount',
36
+ :'error_details' => :'ErrorDetails'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.swagger_types
42
+ {
43
+ :'successful' => :'BOOLEAN',
44
+ :'faces' => :'Array<Face>',
45
+ :'face_count' => :'Integer',
46
+ :'error_details' => :'String'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'Successful')
59
+ self.successful = attributes[:'Successful']
60
+ end
61
+
62
+ if attributes.has_key?(:'Faces')
63
+ if (value = attributes[:'Faces']).is_a?(Array)
64
+ self.faces = value
65
+ end
66
+ end
67
+
68
+ if attributes.has_key?(:'FaceCount')
69
+ self.face_count = attributes[:'FaceCount']
70
+ end
71
+
72
+ if attributes.has_key?(:'ErrorDetails')
73
+ self.error_details = attributes[:'ErrorDetails']
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ successful == o.successful &&
96
+ faces == o.faces &&
97
+ face_count == o.face_count &&
98
+ error_details == o.error_details
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Fixnum] Hash code
109
+ def hash
110
+ [successful, faces, face_count, error_details].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.swagger_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :BOOLEAN
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
171
+ temp_model.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ next if value.nil?
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+ end
@@ -0,0 +1,218 @@
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.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveImageRecognitionApiClient
16
+ # Results of locating faces in an image
17
+ class FaceLocateWithLandmarksResponse
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Array of faces found in the image
22
+ attr_accessor :faces
23
+
24
+ # Number of faces found in the image
25
+ attr_accessor :face_count
26
+
27
+ # Details of any errors that occurred
28
+ attr_accessor :error_details
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'successful' => :'Successful',
34
+ :'faces' => :'Faces',
35
+ :'face_count' => :'FaceCount',
36
+ :'error_details' => :'ErrorDetails'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.swagger_types
42
+ {
43
+ :'successful' => :'BOOLEAN',
44
+ :'faces' => :'Array<FaceWithLandmarks>',
45
+ :'face_count' => :'Integer',
46
+ :'error_details' => :'String'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'Successful')
59
+ self.successful = attributes[:'Successful']
60
+ end
61
+
62
+ if attributes.has_key?(:'Faces')
63
+ if (value = attributes[:'Faces']).is_a?(Array)
64
+ self.faces = value
65
+ end
66
+ end
67
+
68
+ if attributes.has_key?(:'FaceCount')
69
+ self.face_count = attributes[:'FaceCount']
70
+ end
71
+
72
+ if attributes.has_key?(:'ErrorDetails')
73
+ self.error_details = attributes[:'ErrorDetails']
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ successful == o.successful &&
96
+ faces == o.faces &&
97
+ face_count == o.face_count &&
98
+ error_details == o.error_details
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Fixnum] Hash code
109
+ def hash
110
+ [successful, faces, face_count, error_details].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.swagger_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :BOOLEAN
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
171
+ temp_model.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ next if value.nil?
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+ end
@@ -0,0 +1,236 @@
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.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveImageRecognitionApiClient
16
+ # Location of one face in an image, along with match results
17
+ class FaceMatch
18
+ # X coordinate of the left side of the face
19
+ attr_accessor :left_x
20
+
21
+ # Y coordinate of the top side of the face
22
+ attr_accessor :top_y
23
+
24
+ # X coordinate of the right side of the face
25
+ attr_accessor :right_x
26
+
27
+ # Y coordinate of the bottom side of the face
28
+ attr_accessor :bottom_y
29
+
30
+ # True if there is a high confidence match, false otherwise
31
+ attr_accessor :high_confidence_match
32
+
33
+ # Match score from 0.0 to 1.0 with higher scores indicating a greater match; scores above 0.7 indicate a match
34
+ attr_accessor :match_score
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'left_x' => :'LeftX',
40
+ :'top_y' => :'TopY',
41
+ :'right_x' => :'RightX',
42
+ :'bottom_y' => :'BottomY',
43
+ :'high_confidence_match' => :'HighConfidenceMatch',
44
+ :'match_score' => :'MatchScore'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ :'left_x' => :'Integer',
52
+ :'top_y' => :'Integer',
53
+ :'right_x' => :'Integer',
54
+ :'bottom_y' => :'Integer',
55
+ :'high_confidence_match' => :'BOOLEAN',
56
+ :'match_score' => :'Float'
57
+ }
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ return unless attributes.is_a?(Hash)
64
+
65
+ # convert string to symbol for hash key
66
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
67
+
68
+ if attributes.has_key?(:'LeftX')
69
+ self.left_x = attributes[:'LeftX']
70
+ end
71
+
72
+ if attributes.has_key?(:'TopY')
73
+ self.top_y = attributes[:'TopY']
74
+ end
75
+
76
+ if attributes.has_key?(:'RightX')
77
+ self.right_x = attributes[:'RightX']
78
+ end
79
+
80
+ if attributes.has_key?(:'BottomY')
81
+ self.bottom_y = attributes[:'BottomY']
82
+ end
83
+
84
+ if attributes.has_key?(:'HighConfidenceMatch')
85
+ self.high_confidence_match = attributes[:'HighConfidenceMatch']
86
+ end
87
+
88
+ if attributes.has_key?(:'MatchScore')
89
+ self.match_score = attributes[:'MatchScore']
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ left_x == o.left_x &&
112
+ top_y == o.top_y &&
113
+ right_x == o.right_x &&
114
+ bottom_y == o.bottom_y &&
115
+ high_confidence_match == o.high_confidence_match &&
116
+ match_score == o.match_score
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Fixnum] Hash code
127
+ def hash
128
+ [left_x, top_y, right_x, bottom_y, high_confidence_match, match_score].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ self.class.swagger_types.each_pair do |key, type|
137
+ if type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :DateTime
158
+ DateTime.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :BOOLEAN
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
189
+ temp_model.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ next if value.nil?
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+ end