cloudmersive-image-recognition-api-client 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +132 -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/DetectedLicensePlate.md +14 -0
  9. data/docs/DetectedObject.md +13 -0
  10. data/docs/DrawRectangleInstance.md +14 -0
  11. data/docs/DrawRectangleRequest.md +10 -0
  12. data/docs/DrawTextInstance.md +15 -0
  13. data/docs/DrawTextRequest.md +10 -0
  14. data/docs/EditApi.md +179 -0
  15. data/docs/Face.md +11 -0
  16. data/docs/FaceApi.md +228 -0
  17. data/docs/FaceLocateResponse.md +11 -0
  18. data/docs/ImageDescriptionResponse.md +11 -0
  19. data/docs/NsfwApi.md +63 -0
  20. data/docs/NsfwResult.md +10 -0
  21. data/docs/ObjectDetectionResult.md +10 -0
  22. data/docs/PersonWithAge.md +10 -0
  23. data/docs/RecognitionOutcome.md +9 -0
  24. data/docs/RecognizeApi.md +287 -0
  25. data/docs/ResizeApi.md +69 -0
  26. data/docs/VehicleLicensePlateDetectionResult.md +10 -0
  27. data/git_push.sh +55 -0
  28. data/lib/cloudmersive-image-recognition-api-client.rb +60 -0
  29. data/lib/cloudmersive-image-recognition-api-client/api/artistic_api.rb +85 -0
  30. data/lib/cloudmersive-image-recognition-api-client/api/edit_api.rb +202 -0
  31. data/lib/cloudmersive-image-recognition-api-client/api/face_api.rb +247 -0
  32. data/lib/cloudmersive-image-recognition-api-client/api/nsfw_api.rb +79 -0
  33. data/lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb +306 -0
  34. data/lib/cloudmersive-image-recognition-api-client/api/resize_api.rb +91 -0
  35. data/lib/cloudmersive-image-recognition-api-client/api_client.rb +389 -0
  36. data/lib/cloudmersive-image-recognition-api-client/api_error.rb +38 -0
  37. data/lib/cloudmersive-image-recognition-api-client/configuration.rb +209 -0
  38. data/lib/cloudmersive-image-recognition-api-client/models/age_detection_result.rb +211 -0
  39. data/lib/cloudmersive-image-recognition-api-client/models/detected_license_plate.rb +245 -0
  40. data/lib/cloudmersive-image-recognition-api-client/models/detected_object.rb +239 -0
  41. data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_instance.rb +249 -0
  42. data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_request.rb +227 -0
  43. data/lib/cloudmersive-image-recognition-api-client/models/draw_text_instance.rb +259 -0
  44. data/lib/cloudmersive-image-recognition-api-client/models/draw_text_request.rb +227 -0
  45. data/lib/cloudmersive-image-recognition-api-client/models/face.rb +219 -0
  46. data/lib/cloudmersive-image-recognition-api-client/models/face_locate_response.rb +220 -0
  47. data/lib/cloudmersive-image-recognition-api-client/models/image_description_response.rb +219 -0
  48. data/lib/cloudmersive-image-recognition-api-client/models/nsfw_result.rb +209 -0
  49. data/lib/cloudmersive-image-recognition-api-client/models/object_detection_result.rb +211 -0
  50. data/lib/cloudmersive-image-recognition-api-client/models/person_with_age.rb +209 -0
  51. data/lib/cloudmersive-image-recognition-api-client/models/recognition_outcome.rb +199 -0
  52. data/lib/cloudmersive-image-recognition-api-client/models/vehicle_license_plate_detection_result.rb +211 -0
  53. data/lib/cloudmersive-image-recognition-api-client/version.rb +15 -0
  54. data/spec/api/artistic_api_spec.rb +48 -0
  55. data/spec/api/edit_api_spec.rb +73 -0
  56. data/spec/api/face_api_spec.rb +83 -0
  57. data/spec/api/nsfw_api_spec.rb +47 -0
  58. data/spec/api/recognize_api_spec.rb +96 -0
  59. data/spec/api/resize_api_spec.rb +49 -0
  60. data/spec/api_client_spec.rb +226 -0
  61. data/spec/configuration_spec.rb +42 -0
  62. data/spec/models/age_detection_result_spec.rb +54 -0
  63. data/spec/models/detected_license_plate_spec.rb +78 -0
  64. data/spec/models/detected_object_spec.rb +72 -0
  65. data/spec/models/draw_rectangle_instance_spec.rb +78 -0
  66. data/spec/models/draw_rectangle_request_spec.rb +54 -0
  67. data/spec/models/draw_text_instance_spec.rb +84 -0
  68. data/spec/models/draw_text_request_spec.rb +54 -0
  69. data/spec/models/face_locate_response_spec.rb +60 -0
  70. data/spec/models/face_spec.rb +60 -0
  71. data/spec/models/image_description_response_spec.rb +60 -0
  72. data/spec/models/nsfw_result_spec.rb +54 -0
  73. data/spec/models/object_detection_result_spec.rb +54 -0
  74. data/spec/models/person_with_age_spec.rb +54 -0
  75. data/spec/models/recognition_outcome_spec.rb +48 -0
  76. data/spec/models/vehicle_license_plate_detection_result_spec.rb +54 -0
  77. data/spec/spec_helper.rb +111 -0
  78. metadata +302 -0
@@ -0,0 +1,249 @@
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
+ # Rectangle instance to draw on an image
17
+ class DrawRectangleInstance
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 rectangle 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 rectangle.
25
+ attr_accessor :fill_color
26
+
27
+ # Pixel location of the left edge of the rectangle location
28
+ attr_accessor :x
29
+
30
+ # Pixel location of the top edge of the rectangle location
31
+ attr_accessor :y
32
+
33
+ # Width in pixels of the rectangle
34
+ attr_accessor :width
35
+
36
+ # Height in pixels of the rectangle
37
+ attr_accessor :height
38
+
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'border_color' => :'BorderColor',
44
+ :'border_width' => :'BorderWidth',
45
+ :'fill_color' => :'FillColor',
46
+ :'x' => :'X',
47
+ :'y' => :'Y',
48
+ :'width' => :'Width',
49
+ :'height' => :'Height'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.swagger_types
55
+ {
56
+ :'border_color' => :'String',
57
+ :'border_width' => :'Float',
58
+ :'fill_color' => :'String',
59
+ :'x' => :'Float',
60
+ :'y' => :'Float',
61
+ :'width' => :'Float',
62
+ :'height' => :'Float'
63
+ }
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ return unless attributes.is_a?(Hash)
70
+
71
+ # convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
73
+
74
+ if attributes.has_key?(:'BorderColor')
75
+ self.border_color = attributes[:'BorderColor']
76
+ end
77
+
78
+ if attributes.has_key?(:'BorderWidth')
79
+ self.border_width = attributes[:'BorderWidth']
80
+ end
81
+
82
+ if attributes.has_key?(:'FillColor')
83
+ self.fill_color = attributes[:'FillColor']
84
+ end
85
+
86
+ if attributes.has_key?(:'X')
87
+ self.x = attributes[:'X']
88
+ end
89
+
90
+ if attributes.has_key?(:'Y')
91
+ self.y = attributes[:'Y']
92
+ end
93
+
94
+ if attributes.has_key?(:'Width')
95
+ self.width = attributes[:'Width']
96
+ end
97
+
98
+ if attributes.has_key?(:'Height')
99
+ self.height = attributes[:'Height']
100
+ end
101
+
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ return invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ return true
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ border_color == o.border_color &&
123
+ border_width == o.border_width &&
124
+ fill_color == o.fill_color &&
125
+ x == o.x &&
126
+ y == o.y &&
127
+ width == o.width &&
128
+ height == o.height
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Fixnum] Hash code
139
+ def hash
140
+ [border_color, border_width, fill_color, x, y, width, height].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ self.class.swagger_types.each_pair do |key, type|
149
+ if type =~ /\AArray<(.*)>/i
150
+ # check to ensure the input is an array given that the the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
153
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
154
+ end
155
+ elsif !attributes[self.class.attribute_map[key]].nil?
156
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
157
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
158
+ end
159
+
160
+ self
161
+ end
162
+
163
+ # Deserializes the data based on type
164
+ # @param string type Data type
165
+ # @param string value Value to be deserialized
166
+ # @return [Object] Deserialized data
167
+ def _deserialize(type, value)
168
+ case type.to_sym
169
+ when :DateTime
170
+ DateTime.parse(value)
171
+ when :Date
172
+ Date.parse(value)
173
+ when :String
174
+ value.to_s
175
+ when :Integer
176
+ value.to_i
177
+ when :Float
178
+ value.to_f
179
+ when :BOOLEAN
180
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
+ true
182
+ else
183
+ false
184
+ end
185
+ when :Object
186
+ # generic object (usually a Hash), return directly
187
+ value
188
+ when /\AArray<(?<inner_type>.+)>\z/
189
+ inner_type = Regexp.last_match[:inner_type]
190
+ value.map { |v| _deserialize(inner_type, v) }
191
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
+ k_type = Regexp.last_match[:k_type]
193
+ v_type = Regexp.last_match[:v_type]
194
+ {}.tap do |hash|
195
+ value.each do |k, v|
196
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
+ end
198
+ end
199
+ else # model
200
+ temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
201
+ temp_model.build_from_hash(value)
202
+ end
203
+ end
204
+
205
+ # Returns the string representation of the object
206
+ # @return [String] String presentation of the object
207
+ def to_s
208
+ to_hash.to_s
209
+ end
210
+
211
+ # to_body is an alias to to_hash (backward compatibility)
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_body
214
+ to_hash
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ next if value.nil?
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map{ |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+
247
+ end
248
+
249
+ 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 rectangles on a base image
17
+ class DrawRectangleRequest
18
+ # Image to draw rectangles 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 rectangles on, as an HTTP or HTTPS fully-qualified URL
22
+ attr_accessor :base_image_url
23
+
24
+ # Rectangles to draw on the image. Rectangles are drawn in index order.
25
+ attr_accessor :rectangles_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
+ :'rectangles_to_draw' => :'RectanglesToDraw'
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
+ :'rectangles_to_draw' => :'Array<DrawRectangleInstance>'
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?(:'RectanglesToDraw')
63
+ if (value = attributes[:'RectanglesToDraw']).is_a?(Array)
64
+ self.rectangles_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
+ rectangles_to_draw == o.rectangles_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, rectangles_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