cloudmersive-image-recognition-api-client 2.0.5 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -19
  3. data/cloudmersive-image-recognition-api-client.gemspec +1 -1
  4. data/docs/AgeDetectionResult.md +1 -1
  5. data/docs/AiImageDetectionApi.md +63 -0
  6. data/docs/ConvertApi.md +58 -3
  7. data/docs/FaceApi.md +4 -4
  8. data/docs/FineTextItem.md +1 -0
  9. data/docs/ImageAiDetectionResult.md +10 -0
  10. data/docs/NsfwAdvancedResult.md +19 -0
  11. data/docs/NsfwApi.md +169 -4
  12. data/docs/PersonWithAge.md +4 -1
  13. data/docs/RecognizeApi.md +0 -110
  14. data/docs/ResizeApi.md +55 -0
  15. data/docs/TextItem.md +1 -0
  16. data/lib/cloudmersive-image-recognition-api-client/api/ai_image_detection_api.rb +78 -0
  17. data/lib/cloudmersive-image-recognition-api-client/api/artistic_api.rb +1 -1
  18. data/lib/cloudmersive-image-recognition-api-client/api/convert_api.rb +58 -3
  19. data/lib/cloudmersive-image-recognition-api-client/api/edit_api.rb +1 -1
  20. data/lib/cloudmersive-image-recognition-api-client/api/face_api.rb +8 -8
  21. data/lib/cloudmersive-image-recognition-api-client/api/filter_api.rb +1 -1
  22. data/lib/cloudmersive-image-recognition-api-client/api/info_api.rb +1 -1
  23. data/lib/cloudmersive-image-recognition-api-client/api/nsfw_api.rb +170 -5
  24. data/lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb +1 -111
  25. data/lib/cloudmersive-image-recognition-api-client/api/resize_api.rb +56 -1
  26. data/lib/cloudmersive-image-recognition-api-client/api/text_generation_api.rb +1 -1
  27. data/lib/cloudmersive-image-recognition-api-client/api_client.rb +1 -1
  28. data/lib/cloudmersive-image-recognition-api-client/api_error.rb +1 -1
  29. data/lib/cloudmersive-image-recognition-api-client/configuration.rb +1 -1
  30. data/lib/cloudmersive-image-recognition-api-client/models/age_detection_result.rb +3 -3
  31. data/lib/cloudmersive-image-recognition-api-client/models/color_result.rb +1 -1
  32. data/lib/cloudmersive-image-recognition-api-client/models/create_handwriting_request.rb +1 -1
  33. data/lib/cloudmersive-image-recognition-api-client/models/detected_license_plate.rb +1 -1
  34. data/lib/cloudmersive-image-recognition-api-client/models/dominant_color_result.rb +1 -1
  35. data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_instance.rb +1 -1
  36. data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_request.rb +1 -1
  37. data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_instance.rb +1 -1
  38. data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_request.rb +1 -1
  39. data/lib/cloudmersive-image-recognition-api-client/models/draw_text_instance.rb +1 -1
  40. data/lib/cloudmersive-image-recognition-api-client/models/draw_text_request.rb +1 -1
  41. data/lib/cloudmersive-image-recognition-api-client/models/face.rb +1 -1
  42. data/lib/cloudmersive-image-recognition-api-client/models/face_compare_response.rb +1 -1
  43. data/lib/cloudmersive-image-recognition-api-client/models/face_locate_response.rb +1 -1
  44. data/lib/cloudmersive-image-recognition-api-client/models/face_locate_with_landmarks_response.rb +1 -1
  45. data/lib/cloudmersive-image-recognition-api-client/models/face_match.rb +1 -1
  46. data/lib/cloudmersive-image-recognition-api-client/models/face_point.rb +1 -1
  47. data/lib/cloudmersive-image-recognition-api-client/models/face_with_landmarks.rb +1 -1
  48. data/lib/cloudmersive-image-recognition-api-client/models/find_symbol_result.rb +1 -1
  49. data/lib/cloudmersive-image-recognition-api-client/models/fine_text_detection_result.rb +1 -1
  50. data/lib/cloudmersive-image-recognition-api-client/models/fine_text_item.rb +12 -2
  51. data/lib/cloudmersive-image-recognition-api-client/models/{gender_detection_result.rb → image_ai_detection_result.rb} +25 -27
  52. data/lib/cloudmersive-image-recognition-api-client/models/image_description_response.rb +1 -1
  53. data/lib/cloudmersive-image-recognition-api-client/models/image_metadata.rb +1 -1
  54. data/lib/cloudmersive-image-recognition-api-client/models/image_metadata_exif_value.rb +1 -1
  55. data/lib/cloudmersive-image-recognition-api-client/models/image_similarity_comparison_response.rb +1 -1
  56. data/lib/cloudmersive-image-recognition-api-client/models/image_similarity_hash_distance_request.rb +1 -1
  57. data/lib/cloudmersive-image-recognition-api-client/models/image_similarity_hash_distance_response.rb +1 -1
  58. data/lib/cloudmersive-image-recognition-api-client/models/image_similarity_hash_response.rb +1 -1
  59. data/lib/cloudmersive-image-recognition-api-client/models/nsfw_advanced_result.rb +296 -0
  60. data/lib/cloudmersive-image-recognition-api-client/models/nsfw_result.rb +1 -1
  61. data/lib/cloudmersive-image-recognition-api-client/models/person_with_age.rb +36 -5
  62. data/lib/cloudmersive-image-recognition-api-client/models/polygon_point.rb +1 -1
  63. data/lib/cloudmersive-image-recognition-api-client/models/recognition_outcome.rb +1 -1
  64. data/lib/cloudmersive-image-recognition-api-client/models/text_detection_result.rb +1 -1
  65. data/lib/cloudmersive-image-recognition-api-client/models/text_item.rb +12 -2
  66. data/lib/cloudmersive-image-recognition-api-client/models/vehicle_license_plate_detection_result.rb +1 -1
  67. data/lib/cloudmersive-image-recognition-api-client/version.rb +2 -2
  68. data/lib/cloudmersive-image-recognition-api-client.rb +4 -5
  69. data/spec/api/ai_image_detection_api_spec.rb +47 -0
  70. data/spec/api/artistic_api_spec.rb +1 -1
  71. data/spec/api/convert_api_spec.rb +14 -2
  72. data/spec/api/edit_api_spec.rb +1 -1
  73. data/spec/api/face_api_spec.rb +4 -4
  74. data/spec/api/filter_api_spec.rb +1 -1
  75. data/spec/api/info_api_spec.rb +1 -1
  76. data/spec/api/nsfw_api_spec.rb +39 -3
  77. data/spec/api/recognize_api_spec.rb +1 -25
  78. data/spec/api/resize_api_spec.rb +13 -1
  79. data/spec/api/text_generation_api_spec.rb +1 -1
  80. data/spec/api_client_spec.rb +1 -1
  81. data/spec/configuration_spec.rb +1 -1
  82. data/spec/models/age_detection_result_spec.rb +1 -1
  83. data/spec/models/color_result_spec.rb +1 -1
  84. data/spec/models/create_handwriting_request_spec.rb +1 -1
  85. data/spec/models/detected_license_plate_spec.rb +1 -1
  86. data/spec/models/dominant_color_result_spec.rb +1 -1
  87. data/spec/models/draw_polygon_instance_spec.rb +1 -1
  88. data/spec/models/draw_polygon_request_spec.rb +1 -1
  89. data/spec/models/draw_rectangle_instance_spec.rb +1 -1
  90. data/spec/models/draw_rectangle_request_spec.rb +1 -1
  91. data/spec/models/draw_text_instance_spec.rb +1 -1
  92. data/spec/models/draw_text_request_spec.rb +1 -1
  93. data/spec/models/face_compare_response_spec.rb +1 -1
  94. data/spec/models/face_locate_response_spec.rb +1 -1
  95. data/spec/models/face_locate_with_landmarks_response_spec.rb +1 -1
  96. data/spec/models/face_match_spec.rb +1 -1
  97. data/spec/models/face_point_spec.rb +1 -1
  98. data/spec/models/face_spec.rb +1 -1
  99. data/spec/models/face_with_landmarks_spec.rb +1 -1
  100. data/spec/models/find_symbol_result_spec.rb +1 -1
  101. data/spec/models/fine_text_detection_result_spec.rb +1 -1
  102. data/spec/models/fine_text_item_spec.rb +7 -1
  103. data/spec/models/{person_with_gender_spec.rb → image_ai_detection_result_spec.rb} +10 -10
  104. data/spec/models/image_description_response_spec.rb +1 -1
  105. data/spec/models/image_metadata_exif_value_spec.rb +1 -1
  106. data/spec/models/image_metadata_spec.rb +1 -1
  107. data/spec/models/image_similarity_comparison_response_spec.rb +1 -1
  108. data/spec/models/image_similarity_hash_distance_request_spec.rb +1 -1
  109. data/spec/models/image_similarity_hash_distance_response_spec.rb +1 -1
  110. data/spec/models/image_similarity_hash_response_spec.rb +1 -1
  111. data/spec/models/nsfw_advanced_result_spec.rb +107 -0
  112. data/spec/models/nsfw_result_spec.rb +1 -1
  113. data/spec/models/person_with_age_spec.rb +19 -1
  114. data/spec/models/polygon_point_spec.rb +1 -1
  115. data/spec/models/recognition_outcome_spec.rb +1 -1
  116. data/spec/models/text_detection_result_spec.rb +1 -1
  117. data/spec/models/text_item_spec.rb +7 -1
  118. data/spec/models/vehicle_license_plate_detection_result_spec.rb +1 -1
  119. data/spec/spec_helper.rb +1 -1
  120. metadata +27 -30
  121. data/docs/DetectedObject.md +0 -13
  122. data/docs/GenderDetectionResult.md +0 -10
  123. data/docs/ObjectDetectionResult.md +0 -10
  124. data/docs/PersonWithGender.md +0 -10
  125. data/lib/cloudmersive-image-recognition-api-client/models/detected_object.rb +0 -236
  126. data/lib/cloudmersive-image-recognition-api-client/models/object_detection_result.rb +0 -208
  127. data/lib/cloudmersive-image-recognition-api-client/models/person_with_gender.rb +0 -206
  128. data/spec/models/detected_object_spec.rb +0 -71
  129. data/spec/models/gender_detection_result_spec.rb +0 -53
  130. data/spec/models/object_detection_result_spec.rb +0 -53
@@ -1,236 +0,0 @@
1
- =begin
2
- #imageapi
3
-
4
- #Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.14
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveImageRecognitionApiClient
16
- # Single object instance, and associated details, detected in an image
17
- class DetectedObject
18
- # Class of the object. Example values are \"person\", \"car\", \"dining table\", etc.
19
- attr_accessor :object_class_name
20
-
21
- # Height, in pixels, of the object
22
- attr_accessor :height
23
-
24
- # Width, in pixels, of the object
25
- attr_accessor :width
26
-
27
- # Confidence score of detected object; possible values are between 0.0 and 1.0; values closer to 1.0 are higher confidence
28
- attr_accessor :score
29
-
30
- # X location, in pixels, of the left side location of the object, with the right side being X + Width
31
- attr_accessor :x
32
-
33
- # Y location, in pixels, of the top side location of the object, with the bottom side being Y + Height
34
- attr_accessor :y
35
-
36
- # Attribute mapping from ruby-style variable name to JSON key.
37
- def self.attribute_map
38
- {
39
- :'object_class_name' => :'ObjectClassName',
40
- :'height' => :'Height',
41
- :'width' => :'Width',
42
- :'score' => :'Score',
43
- :'x' => :'X',
44
- :'y' => :'Y'
45
- }
46
- end
47
-
48
- # Attribute type mapping.
49
- def self.swagger_types
50
- {
51
- :'object_class_name' => :'String',
52
- :'height' => :'Integer',
53
- :'width' => :'Integer',
54
- :'score' => :'Float',
55
- :'x' => :'Integer',
56
- :'y' => :'Integer'
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?(:'ObjectClassName')
69
- self.object_class_name = attributes[:'ObjectClassName']
70
- end
71
-
72
- if attributes.has_key?(:'Height')
73
- self.height = attributes[:'Height']
74
- end
75
-
76
- if attributes.has_key?(:'Width')
77
- self.width = attributes[:'Width']
78
- end
79
-
80
- if attributes.has_key?(:'Score')
81
- self.score = attributes[:'Score']
82
- end
83
-
84
- if attributes.has_key?(:'X')
85
- self.x = attributes[:'X']
86
- end
87
-
88
- if attributes.has_key?(:'Y')
89
- self.y = attributes[:'Y']
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
- object_class_name == o.object_class_name &&
112
- height == o.height &&
113
- width == o.width &&
114
- score == o.score &&
115
- x == o.x &&
116
- y == o.y
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
- [object_class_name, height, width, score, x, y].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
@@ -1,208 +0,0 @@
1
- =begin
2
- #imageapi
3
-
4
- #Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.14
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveImageRecognitionApiClient
16
- # Result of detecting objects in an image
17
- class ObjectDetectionResult
18
- # Was the image processed successfully?
19
- attr_accessor :successful
20
-
21
- # Array of objects detected in the scene
22
- attr_accessor :objects
23
-
24
- # Number of objects detected in the scene
25
- attr_accessor :object_count
26
-
27
- # Attribute mapping from ruby-style variable name to JSON key.
28
- def self.attribute_map
29
- {
30
- :'successful' => :'Successful',
31
- :'objects' => :'Objects',
32
- :'object_count' => :'ObjectCount'
33
- }
34
- end
35
-
36
- # Attribute type mapping.
37
- def self.swagger_types
38
- {
39
- :'successful' => :'BOOLEAN',
40
- :'objects' => :'Array<DetectedObject>',
41
- :'object_count' => :'Integer'
42
- }
43
- end
44
-
45
- # Initializes the object
46
- # @param [Hash] attributes Model attributes in the form of hash
47
- def initialize(attributes = {})
48
- return unless attributes.is_a?(Hash)
49
-
50
- # convert string to symbol for hash key
51
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
52
-
53
- if attributes.has_key?(:'Successful')
54
- self.successful = attributes[:'Successful']
55
- end
56
-
57
- if attributes.has_key?(:'Objects')
58
- if (value = attributes[:'Objects']).is_a?(Array)
59
- self.objects = value
60
- end
61
- end
62
-
63
- if attributes.has_key?(:'ObjectCount')
64
- self.object_count = attributes[:'ObjectCount']
65
- end
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
- 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
- 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
- successful == o.successful &&
87
- objects == o.objects &&
88
- object_count == o.object_count
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
- [successful, objects, object_count].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 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
- end
@@ -1,206 +0,0 @@
1
- =begin
2
- #imageapi
3
-
4
- #Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.14
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveImageRecognitionApiClient
16
- # A person identified in an image gender classification operation
17
- class PersonWithGender
18
- # Location and other information about the person's face corresponding to this age classification
19
- attr_accessor :face_location
20
-
21
- # Confidence level of gender classification; possible values are between 0.0 and 1.0; higher is better, with values &gt; 0.50 being high confidence results
22
- attr_accessor :gender_classification_confidence
23
-
24
- # The person's identified gender; possible values are \"Male\", \"Female\" and \"Unknown\"
25
- attr_accessor :gender_class
26
-
27
- # Attribute mapping from ruby-style variable name to JSON key.
28
- def self.attribute_map
29
- {
30
- :'face_location' => :'FaceLocation',
31
- :'gender_classification_confidence' => :'GenderClassificationConfidence',
32
- :'gender_class' => :'GenderClass'
33
- }
34
- end
35
-
36
- # Attribute type mapping.
37
- def self.swagger_types
38
- {
39
- :'face_location' => :'Face',
40
- :'gender_classification_confidence' => :'Float',
41
- :'gender_class' => :'String'
42
- }
43
- end
44
-
45
- # Initializes the object
46
- # @param [Hash] attributes Model attributes in the form of hash
47
- def initialize(attributes = {})
48
- return unless attributes.is_a?(Hash)
49
-
50
- # convert string to symbol for hash key
51
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
52
-
53
- if attributes.has_key?(:'FaceLocation')
54
- self.face_location = attributes[:'FaceLocation']
55
- end
56
-
57
- if attributes.has_key?(:'GenderClassificationConfidence')
58
- self.gender_classification_confidence = attributes[:'GenderClassificationConfidence']
59
- end
60
-
61
- if attributes.has_key?(:'GenderClass')
62
- self.gender_class = attributes[:'GenderClass']
63
- end
64
- end
65
-
66
- # Show invalid properties with the reasons. Usually used together with valid?
67
- # @return Array for valid properties with the reasons
68
- def list_invalid_properties
69
- invalid_properties = Array.new
70
- invalid_properties
71
- end
72
-
73
- # Check to see if the all the properties in the model are valid
74
- # @return true if the model is valid
75
- def valid?
76
- true
77
- end
78
-
79
- # Checks equality by comparing each attribute.
80
- # @param [Object] Object to be compared
81
- def ==(o)
82
- return true if self.equal?(o)
83
- self.class == o.class &&
84
- face_location == o.face_location &&
85
- gender_classification_confidence == o.gender_classification_confidence &&
86
- gender_class == o.gender_class
87
- end
88
-
89
- # @see the `==` method
90
- # @param [Object] Object to be compared
91
- def eql?(o)
92
- self == o
93
- end
94
-
95
- # Calculates hash code according to all attributes.
96
- # @return [Fixnum] Hash code
97
- def hash
98
- [face_location, gender_classification_confidence, gender_class].hash
99
- end
100
-
101
- # Builds the object from hash
102
- # @param [Hash] attributes Model attributes in the form of hash
103
- # @return [Object] Returns the model itself
104
- def build_from_hash(attributes)
105
- return nil unless attributes.is_a?(Hash)
106
- self.class.swagger_types.each_pair do |key, type|
107
- if type =~ /\AArray<(.*)>/i
108
- # check to ensure the input is an array given that the attribute
109
- # is documented as an array but the input is not
110
- if attributes[self.class.attribute_map[key]].is_a?(Array)
111
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
- end
113
- elsif !attributes[self.class.attribute_map[key]].nil?
114
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
- end # or else data not found in attributes(hash), not an issue as the data can be optional
116
- end
117
-
118
- self
119
- end
120
-
121
- # Deserializes the data based on type
122
- # @param string type Data type
123
- # @param string value Value to be deserialized
124
- # @return [Object] Deserialized data
125
- def _deserialize(type, value)
126
- case type.to_sym
127
- when :DateTime
128
- DateTime.parse(value)
129
- when :Date
130
- Date.parse(value)
131
- when :String
132
- value.to_s
133
- when :Integer
134
- value.to_i
135
- when :Float
136
- value.to_f
137
- when :BOOLEAN
138
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
- true
140
- else
141
- false
142
- end
143
- when :Object
144
- # generic object (usually a Hash), return directly
145
- value
146
- when /\AArray<(?<inner_type>.+)>\z/
147
- inner_type = Regexp.last_match[:inner_type]
148
- value.map { |v| _deserialize(inner_type, v) }
149
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
- k_type = Regexp.last_match[:k_type]
151
- v_type = Regexp.last_match[:v_type]
152
- {}.tap do |hash|
153
- value.each do |k, v|
154
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
- end
156
- end
157
- else # model
158
- temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
159
- temp_model.build_from_hash(value)
160
- end
161
- end
162
-
163
- # Returns the string representation of the object
164
- # @return [String] String presentation of the object
165
- def to_s
166
- to_hash.to_s
167
- end
168
-
169
- # to_body is an alias to to_hash (backward compatibility)
170
- # @return [Hash] Returns the object in the form of hash
171
- def to_body
172
- to_hash
173
- end
174
-
175
- # Returns the object in the form of hash
176
- # @return [Hash] Returns the object in the form of hash
177
- def to_hash
178
- hash = {}
179
- self.class.attribute_map.each_pair do |attr, param|
180
- value = self.send(attr)
181
- next if value.nil?
182
- hash[param] = _to_hash(value)
183
- end
184
- hash
185
- end
186
-
187
- # Outputs non-array value in the form of hash
188
- # For object, use to_hash. Otherwise, just return the value
189
- # @param [Object] value Any valid value
190
- # @return [Hash] Returns the value in the form of hash
191
- def _to_hash(value)
192
- if value.is_a?(Array)
193
- value.compact.map { |v| _to_hash(v) }
194
- elsif value.is_a?(Hash)
195
- {}.tap do |hash|
196
- value.each { |k, v| hash[k] = _to_hash(v) }
197
- end
198
- elsif value.respond_to? :to_hash
199
- value.to_hash
200
- else
201
- value
202
- end
203
- end
204
-
205
- end
206
- end