cloudmersive-image-recognition-api-client 2.0.4 → 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 (129) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -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/ImageSimilarityComparisonResponse.md +10 -0
  11. data/docs/ImageSimilarityHashDistanceRequest.md +9 -0
  12. data/docs/ImageSimilarityHashDistanceResponse.md +9 -0
  13. data/docs/ImageSimilarityHashResponse.md +9 -0
  14. data/docs/NsfwAdvancedResult.md +19 -0
  15. data/docs/NsfwApi.md +169 -4
  16. data/docs/PersonWithAge.md +4 -1
  17. data/docs/RecognizeApi.md +124 -58
  18. data/docs/ResizeApi.md +55 -0
  19. data/docs/TextItem.md +1 -0
  20. data/lib/cloudmersive-image-recognition-api-client/api/ai_image_detection_api.rb +78 -0
  21. data/lib/cloudmersive-image-recognition-api-client/api/artistic_api.rb +1 -1
  22. data/lib/cloudmersive-image-recognition-api-client/api/convert_api.rb +58 -3
  23. data/lib/cloudmersive-image-recognition-api-client/api/edit_api.rb +1 -1
  24. data/lib/cloudmersive-image-recognition-api-client/api/face_api.rb +8 -8
  25. data/lib/cloudmersive-image-recognition-api-client/api/filter_api.rb +1 -1
  26. data/lib/cloudmersive-image-recognition-api-client/api/info_api.rb +1 -1
  27. data/lib/cloudmersive-image-recognition-api-client/api/nsfw_api.rb +170 -5
  28. data/lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb +171 -104
  29. data/lib/cloudmersive-image-recognition-api-client/api/resize_api.rb +56 -1
  30. data/lib/cloudmersive-image-recognition-api-client/api/text_generation_api.rb +1 -1
  31. data/lib/cloudmersive-image-recognition-api-client/api_client.rb +1 -1
  32. data/lib/cloudmersive-image-recognition-api-client/api_error.rb +1 -1
  33. data/lib/cloudmersive-image-recognition-api-client/configuration.rb +1 -1
  34. data/lib/cloudmersive-image-recognition-api-client/models/age_detection_result.rb +3 -3
  35. data/lib/cloudmersive-image-recognition-api-client/models/color_result.rb +1 -1
  36. data/lib/cloudmersive-image-recognition-api-client/models/create_handwriting_request.rb +1 -1
  37. data/lib/cloudmersive-image-recognition-api-client/models/detected_license_plate.rb +1 -1
  38. data/lib/cloudmersive-image-recognition-api-client/models/dominant_color_result.rb +1 -1
  39. data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_instance.rb +1 -1
  40. data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_request.rb +1 -1
  41. data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_instance.rb +1 -1
  42. data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_request.rb +1 -1
  43. data/lib/cloudmersive-image-recognition-api-client/models/draw_text_instance.rb +1 -1
  44. data/lib/cloudmersive-image-recognition-api-client/models/draw_text_request.rb +1 -1
  45. data/lib/cloudmersive-image-recognition-api-client/models/face.rb +1 -1
  46. data/lib/cloudmersive-image-recognition-api-client/models/face_compare_response.rb +1 -1
  47. data/lib/cloudmersive-image-recognition-api-client/models/face_locate_response.rb +1 -1
  48. data/lib/cloudmersive-image-recognition-api-client/models/face_locate_with_landmarks_response.rb +1 -1
  49. data/lib/cloudmersive-image-recognition-api-client/models/face_match.rb +1 -1
  50. data/lib/cloudmersive-image-recognition-api-client/models/face_point.rb +1 -1
  51. data/lib/cloudmersive-image-recognition-api-client/models/face_with_landmarks.rb +1 -1
  52. data/lib/cloudmersive-image-recognition-api-client/models/find_symbol_result.rb +1 -1
  53. data/lib/cloudmersive-image-recognition-api-client/models/fine_text_detection_result.rb +1 -1
  54. data/lib/cloudmersive-image-recognition-api-client/models/fine_text_item.rb +12 -2
  55. data/lib/cloudmersive-image-recognition-api-client/models/{person_with_gender.rb → image_ai_detection_result.rb} +25 -25
  56. data/lib/cloudmersive-image-recognition-api-client/models/image_description_response.rb +1 -1
  57. data/lib/cloudmersive-image-recognition-api-client/models/image_metadata.rb +1 -1
  58. data/lib/cloudmersive-image-recognition-api-client/models/image_metadata_exif_value.rb +1 -1
  59. data/lib/cloudmersive-image-recognition-api-client/models/{detected_object.rb → image_similarity_comparison_response.rb} +25 -55
  60. data/lib/cloudmersive-image-recognition-api-client/models/image_similarity_hash_distance_request.rb +196 -0
  61. data/lib/cloudmersive-image-recognition-api-client/models/{object_detection_result.rb → image_similarity_hash_distance_response.rb} +12 -24
  62. data/lib/cloudmersive-image-recognition-api-client/models/{gender_detection_result.rb → image_similarity_hash_response.rb} +12 -24
  63. data/lib/cloudmersive-image-recognition-api-client/models/nsfw_advanced_result.rb +296 -0
  64. data/lib/cloudmersive-image-recognition-api-client/models/nsfw_result.rb +1 -1
  65. data/lib/cloudmersive-image-recognition-api-client/models/person_with_age.rb +36 -5
  66. data/lib/cloudmersive-image-recognition-api-client/models/polygon_point.rb +1 -1
  67. data/lib/cloudmersive-image-recognition-api-client/models/recognition_outcome.rb +1 -1
  68. data/lib/cloudmersive-image-recognition-api-client/models/text_detection_result.rb +1 -1
  69. data/lib/cloudmersive-image-recognition-api-client/models/text_item.rb +12 -2
  70. data/lib/cloudmersive-image-recognition-api-client/models/vehicle_license_plate_detection_result.rb +1 -1
  71. data/lib/cloudmersive-image-recognition-api-client/version.rb +2 -2
  72. data/lib/cloudmersive-image-recognition-api-client.rb +8 -5
  73. data/spec/api/ai_image_detection_api_spec.rb +47 -0
  74. data/spec/api/artistic_api_spec.rb +1 -1
  75. data/spec/api/convert_api_spec.rb +14 -2
  76. data/spec/api/edit_api_spec.rb +1 -1
  77. data/spec/api/face_api_spec.rb +4 -4
  78. data/spec/api/filter_api_spec.rb +1 -1
  79. data/spec/api/info_api_spec.rb +1 -1
  80. data/spec/api/nsfw_api_spec.rb +39 -3
  81. data/spec/api/recognize_api_spec.rb +40 -25
  82. data/spec/api/resize_api_spec.rb +13 -1
  83. data/spec/api/text_generation_api_spec.rb +1 -1
  84. data/spec/api_client_spec.rb +1 -1
  85. data/spec/configuration_spec.rb +1 -1
  86. data/spec/models/age_detection_result_spec.rb +1 -1
  87. data/spec/models/color_result_spec.rb +1 -1
  88. data/spec/models/create_handwriting_request_spec.rb +1 -1
  89. data/spec/models/detected_license_plate_spec.rb +1 -1
  90. data/spec/models/dominant_color_result_spec.rb +1 -1
  91. data/spec/models/draw_polygon_instance_spec.rb +1 -1
  92. data/spec/models/draw_polygon_request_spec.rb +1 -1
  93. data/spec/models/draw_rectangle_instance_spec.rb +1 -1
  94. data/spec/models/draw_rectangle_request_spec.rb +1 -1
  95. data/spec/models/draw_text_instance_spec.rb +1 -1
  96. data/spec/models/draw_text_request_spec.rb +1 -1
  97. data/spec/models/face_compare_response_spec.rb +1 -1
  98. data/spec/models/face_locate_response_spec.rb +1 -1
  99. data/spec/models/face_locate_with_landmarks_response_spec.rb +1 -1
  100. data/spec/models/face_match_spec.rb +1 -1
  101. data/spec/models/face_point_spec.rb +1 -1
  102. data/spec/models/face_spec.rb +1 -1
  103. data/spec/models/face_with_landmarks_spec.rb +1 -1
  104. data/spec/models/find_symbol_result_spec.rb +1 -1
  105. data/spec/models/fine_text_detection_result_spec.rb +1 -1
  106. data/spec/models/fine_text_item_spec.rb +7 -1
  107. data/spec/models/{person_with_gender_spec.rb → image_ai_detection_result_spec.rb} +10 -10
  108. data/spec/models/image_description_response_spec.rb +1 -1
  109. data/spec/models/image_metadata_exif_value_spec.rb +1 -1
  110. data/spec/models/image_metadata_spec.rb +1 -1
  111. data/spec/models/{gender_detection_result_spec.rb → image_similarity_comparison_response_spec.rb} +9 -9
  112. data/spec/models/image_similarity_hash_distance_request_spec.rb +47 -0
  113. data/spec/models/{object_detection_result_spec.rb → image_similarity_hash_distance_response_spec.rb} +8 -14
  114. data/spec/models/image_similarity_hash_response_spec.rb +47 -0
  115. data/spec/models/nsfw_advanced_result_spec.rb +107 -0
  116. data/spec/models/nsfw_result_spec.rb +1 -1
  117. data/spec/models/person_with_age_spec.rb +19 -1
  118. data/spec/models/polygon_point_spec.rb +1 -1
  119. data/spec/models/recognition_outcome_spec.rb +1 -1
  120. data/spec/models/text_detection_result_spec.rb +1 -1
  121. data/spec/models/text_item_spec.rb +7 -1
  122. data/spec/models/vehicle_license_plate_detection_result_spec.rb +1 -1
  123. data/spec/spec_helper.rb +1 -1
  124. metadata +39 -30
  125. data/docs/DetectedObject.md +0 -13
  126. data/docs/GenderDetectionResult.md +0 -10
  127. data/docs/ObjectDetectionResult.md +0 -10
  128. data/docs/PersonWithGender.md +0 -10
  129. data/spec/models/detected_object_spec.rb +0 -71
@@ -0,0 +1,196 @@
1
+ =begin
2
+ #imageapi
3
+
4
+ #Image Recognition and Processing APIs let you use Artificial Intelligence and 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
+ # Request to compute the similarity between two image hashes
17
+ class ImageSimilarityHashDistanceRequest
18
+ # Image hash computed using Cloudmersive Image Hashing API
19
+ attr_accessor :image_hash1
20
+
21
+ # Image hash computed using Cloudmersive Image Hashing API
22
+ attr_accessor :image_hash2
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'image_hash1' => :'ImageHash1',
28
+ :'image_hash2' => :'ImageHash2'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'image_hash1' => :'String',
36
+ :'image_hash2' => :'String'
37
+ }
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
47
+
48
+ if attributes.has_key?(:'ImageHash1')
49
+ self.image_hash1 = attributes[:'ImageHash1']
50
+ end
51
+
52
+ if attributes.has_key?(:'ImageHash2')
53
+ self.image_hash2 = attributes[:'ImageHash2']
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ image_hash1 == o.image_hash1 &&
76
+ image_hash2 == o.image_hash2
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [image_hash1, image_hash2].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.swagger_types.each_pair do |key, type|
97
+ if type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Deserializes the data based on type
112
+ # @param string type Data type
113
+ # @param string value Value to be deserialized
114
+ # @return [Object] Deserialized data
115
+ def _deserialize(type, value)
116
+ case type.to_sym
117
+ when :DateTime
118
+ DateTime.parse(value)
119
+ when :Date
120
+ Date.parse(value)
121
+ when :String
122
+ value.to_s
123
+ when :Integer
124
+ value.to_i
125
+ when :Float
126
+ value.to_f
127
+ when :BOOLEAN
128
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
+ true
130
+ else
131
+ false
132
+ end
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ else # model
148
+ temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
149
+ temp_model.build_from_hash(value)
150
+ end
151
+ end
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # to_body is an alias to to_hash (backward compatibility)
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_body
162
+ to_hash
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+
195
+ end
196
+ end
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #imageapi
3
3
 
4
- #Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
4
+ #Image Recognition and Processing APIs let you use Artificial Intelligence and Machine Learning to recognize and process images, and also perform useful image modification operations.
5
5
 
6
6
  OpenAPI spec version: v1
7
7
 
@@ -13,23 +13,19 @@ Swagger Codegen version: 2.4.14
13
13
  require 'date'
14
14
 
15
15
  module CloudmersiveImageRecognitionApiClient
16
- # Result of detecting objects in an image
17
- class ObjectDetectionResult
18
- # Was the image processed successfully?
16
+ # Result of computing the similarity between two image hashes
17
+ class ImageSimilarityHashDistanceResponse
18
+ # True if successful, false otherwise
19
19
  attr_accessor :successful
20
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
21
+ # Similarity score between 0.0 and 1.0, with 1.0 meaning highly similar and 0.0 meaning highly dissimilar
22
+ attr_accessor :image_similarity_score
26
23
 
27
24
  # Attribute mapping from ruby-style variable name to JSON key.
28
25
  def self.attribute_map
29
26
  {
30
27
  :'successful' => :'Successful',
31
- :'objects' => :'Objects',
32
- :'object_count' => :'ObjectCount'
28
+ :'image_similarity_score' => :'ImageSimilarityScore'
33
29
  }
34
30
  end
35
31
 
@@ -37,8 +33,7 @@ module CloudmersiveImageRecognitionApiClient
37
33
  def self.swagger_types
38
34
  {
39
35
  :'successful' => :'BOOLEAN',
40
- :'objects' => :'Array<DetectedObject>',
41
- :'object_count' => :'Integer'
36
+ :'image_similarity_score' => :'Float'
42
37
  }
43
38
  end
44
39
 
@@ -54,14 +49,8 @@ module CloudmersiveImageRecognitionApiClient
54
49
  self.successful = attributes[:'Successful']
55
50
  end
56
51
 
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']
52
+ if attributes.has_key?(:'ImageSimilarityScore')
53
+ self.image_similarity_score = attributes[:'ImageSimilarityScore']
65
54
  end
66
55
  end
67
56
 
@@ -84,8 +73,7 @@ module CloudmersiveImageRecognitionApiClient
84
73
  return true if self.equal?(o)
85
74
  self.class == o.class &&
86
75
  successful == o.successful &&
87
- objects == o.objects &&
88
- object_count == o.object_count
76
+ image_similarity_score == o.image_similarity_score
89
77
  end
90
78
 
91
79
  # @see the `==` method
@@ -97,7 +85,7 @@ module CloudmersiveImageRecognitionApiClient
97
85
  # Calculates hash code according to all attributes.
98
86
  # @return [Fixnum] Hash code
99
87
  def hash
100
- [successful, objects, object_count].hash
88
+ [successful, image_similarity_score].hash
101
89
  end
102
90
 
103
91
  # Builds the object from hash
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #imageapi
3
3
 
4
- #Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
4
+ #Image Recognition and Processing APIs let you use Artificial Intelligence and Machine Learning to recognize and process images, and also perform useful image modification operations.
5
5
 
6
6
  OpenAPI spec version: v1
7
7
 
@@ -13,23 +13,19 @@ Swagger Codegen version: 2.4.14
13
13
  require 'date'
14
14
 
15
15
  module CloudmersiveImageRecognitionApiClient
16
- # Result from classifying the Gender of people in an image
17
- class GenderDetectionResult
18
- # True if the operation was successful, false otherwise
16
+ # Result of performing an image hash operation
17
+ class ImageSimilarityHashResponse
18
+ # True if successful, false otherwise
19
19
  attr_accessor :successful
20
20
 
21
- # People in the image annotated with gender information
22
- attr_accessor :person_with_gender
23
-
24
- # Number of people identified in the image with a gender
25
- attr_accessor :people_identified
21
+ # String representing image perceptual hash value; values with smaller Hamming Distances are more similar than ones with large Hamming Distances
22
+ attr_accessor :image_hash
26
23
 
27
24
  # Attribute mapping from ruby-style variable name to JSON key.
28
25
  def self.attribute_map
29
26
  {
30
27
  :'successful' => :'Successful',
31
- :'person_with_gender' => :'PersonWithGender',
32
- :'people_identified' => :'PeopleIdentified'
28
+ :'image_hash' => :'ImageHash'
33
29
  }
34
30
  end
35
31
 
@@ -37,8 +33,7 @@ module CloudmersiveImageRecognitionApiClient
37
33
  def self.swagger_types
38
34
  {
39
35
  :'successful' => :'BOOLEAN',
40
- :'person_with_gender' => :'Array<PersonWithGender>',
41
- :'people_identified' => :'Integer'
36
+ :'image_hash' => :'String'
42
37
  }
43
38
  end
44
39
 
@@ -54,14 +49,8 @@ module CloudmersiveImageRecognitionApiClient
54
49
  self.successful = attributes[:'Successful']
55
50
  end
56
51
 
57
- if attributes.has_key?(:'PersonWithGender')
58
- if (value = attributes[:'PersonWithGender']).is_a?(Array)
59
- self.person_with_gender = value
60
- end
61
- end
62
-
63
- if attributes.has_key?(:'PeopleIdentified')
64
- self.people_identified = attributes[:'PeopleIdentified']
52
+ if attributes.has_key?(:'ImageHash')
53
+ self.image_hash = attributes[:'ImageHash']
65
54
  end
66
55
  end
67
56
 
@@ -84,8 +73,7 @@ module CloudmersiveImageRecognitionApiClient
84
73
  return true if self.equal?(o)
85
74
  self.class == o.class &&
86
75
  successful == o.successful &&
87
- person_with_gender == o.person_with_gender &&
88
- people_identified == o.people_identified
76
+ image_hash == o.image_hash
89
77
  end
90
78
 
91
79
  # @see the `==` method
@@ -97,7 +85,7 @@ module CloudmersiveImageRecognitionApiClient
97
85
  # Calculates hash code according to all attributes.
98
86
  # @return [Fixnum] Hash code
99
87
  def hash
100
- [successful, person_with_gender, people_identified].hash
88
+ [successful, image_hash].hash
101
89
  end
102
90
 
103
91
  # Builds the object from hash
@@ -0,0 +1,296 @@
1
+ =begin
2
+ #imageapi
3
+
4
+ #Image Recognition and Processing APIs let you use Artificial Intelligence and 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 an Advanced NSFW classification
17
+ class NsfwAdvancedResult
18
+ # True if the classification was successfully run, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # True if the result was clean, false otherwise
22
+ attr_accessor :clean_result
23
+
24
+ # True if the image contains nudity or sex, false otherwise
25
+ attr_accessor :contains_nudity
26
+
27
+ # True if the image contains graphic violence and/or gore, false otherwise
28
+ attr_accessor :contains_graphic_violence
29
+
30
+ # True if the image contains non-graphic violence, e.g. weapons, false otherwise
31
+ attr_accessor :contains_non_graphic_violence
32
+
33
+ # True if the image contains self-harm or suicide imagery, false otherwise
34
+ attr_accessor :contains_self_harm
35
+
36
+ # True if the image contains hate, false otherwise
37
+ attr_accessor :contains_hate
38
+
39
+ # True if the image contains potentially illegal activity such as drugs, false otherwise
40
+ attr_accessor :contains_potential_illegal_activity
41
+
42
+ # True if the image contains medical imagery, false otherwise
43
+ attr_accessor :contains_medical_imagery
44
+
45
+ # True if the image contains profanity or obscenities, false otherwise
46
+ attr_accessor :contains_profanity
47
+
48
+ # Score between 0.0 and 1.0. Scores of 0.0-0.2 represent high probability safe content, while scores 0.8-1.0 represent high probability unsafe content. Content between 0.2 and 0.8 is of increasing raciness.
49
+ attr_accessor :score
50
+
51
+ # Classification result into four categories: SafeContent_HighProbability, UnsafeContent_HighProbability, RacyContent, SafeContent_ModerateProbability
52
+ attr_accessor :classification_outcome
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'successful' => :'Successful',
58
+ :'clean_result' => :'CleanResult',
59
+ :'contains_nudity' => :'ContainsNudity',
60
+ :'contains_graphic_violence' => :'ContainsGraphicViolence',
61
+ :'contains_non_graphic_violence' => :'ContainsNonGraphicViolence',
62
+ :'contains_self_harm' => :'ContainsSelfHarm',
63
+ :'contains_hate' => :'ContainsHate',
64
+ :'contains_potential_illegal_activity' => :'ContainsPotentialIllegalActivity',
65
+ :'contains_medical_imagery' => :'ContainsMedicalImagery',
66
+ :'contains_profanity' => :'ContainsProfanity',
67
+ :'score' => :'Score',
68
+ :'classification_outcome' => :'ClassificationOutcome'
69
+ }
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.swagger_types
74
+ {
75
+ :'successful' => :'BOOLEAN',
76
+ :'clean_result' => :'BOOLEAN',
77
+ :'contains_nudity' => :'BOOLEAN',
78
+ :'contains_graphic_violence' => :'BOOLEAN',
79
+ :'contains_non_graphic_violence' => :'BOOLEAN',
80
+ :'contains_self_harm' => :'BOOLEAN',
81
+ :'contains_hate' => :'BOOLEAN',
82
+ :'contains_potential_illegal_activity' => :'BOOLEAN',
83
+ :'contains_medical_imagery' => :'BOOLEAN',
84
+ :'contains_profanity' => :'BOOLEAN',
85
+ :'score' => :'Float',
86
+ :'classification_outcome' => :'String'
87
+ }
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ return unless attributes.is_a?(Hash)
94
+
95
+ # convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
97
+
98
+ if attributes.has_key?(:'Successful')
99
+ self.successful = attributes[:'Successful']
100
+ end
101
+
102
+ if attributes.has_key?(:'CleanResult')
103
+ self.clean_result = attributes[:'CleanResult']
104
+ end
105
+
106
+ if attributes.has_key?(:'ContainsNudity')
107
+ self.contains_nudity = attributes[:'ContainsNudity']
108
+ end
109
+
110
+ if attributes.has_key?(:'ContainsGraphicViolence')
111
+ self.contains_graphic_violence = attributes[:'ContainsGraphicViolence']
112
+ end
113
+
114
+ if attributes.has_key?(:'ContainsNonGraphicViolence')
115
+ self.contains_non_graphic_violence = attributes[:'ContainsNonGraphicViolence']
116
+ end
117
+
118
+ if attributes.has_key?(:'ContainsSelfHarm')
119
+ self.contains_self_harm = attributes[:'ContainsSelfHarm']
120
+ end
121
+
122
+ if attributes.has_key?(:'ContainsHate')
123
+ self.contains_hate = attributes[:'ContainsHate']
124
+ end
125
+
126
+ if attributes.has_key?(:'ContainsPotentialIllegalActivity')
127
+ self.contains_potential_illegal_activity = attributes[:'ContainsPotentialIllegalActivity']
128
+ end
129
+
130
+ if attributes.has_key?(:'ContainsMedicalImagery')
131
+ self.contains_medical_imagery = attributes[:'ContainsMedicalImagery']
132
+ end
133
+
134
+ if attributes.has_key?(:'ContainsProfanity')
135
+ self.contains_profanity = attributes[:'ContainsProfanity']
136
+ end
137
+
138
+ if attributes.has_key?(:'Score')
139
+ self.score = attributes[:'Score']
140
+ end
141
+
142
+ if attributes.has_key?(:'ClassificationOutcome')
143
+ self.classification_outcome = attributes[:'ClassificationOutcome']
144
+ end
145
+ end
146
+
147
+ # Show invalid properties with the reasons. Usually used together with valid?
148
+ # @return Array for valid properties with the reasons
149
+ def list_invalid_properties
150
+ invalid_properties = Array.new
151
+ invalid_properties
152
+ end
153
+
154
+ # Check to see if the all the properties in the model are valid
155
+ # @return true if the model is valid
156
+ def valid?
157
+ true
158
+ end
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] Object to be compared
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ successful == o.successful &&
166
+ clean_result == o.clean_result &&
167
+ contains_nudity == o.contains_nudity &&
168
+ contains_graphic_violence == o.contains_graphic_violence &&
169
+ contains_non_graphic_violence == o.contains_non_graphic_violence &&
170
+ contains_self_harm == o.contains_self_harm &&
171
+ contains_hate == o.contains_hate &&
172
+ contains_potential_illegal_activity == o.contains_potential_illegal_activity &&
173
+ contains_medical_imagery == o.contains_medical_imagery &&
174
+ contains_profanity == o.contains_profanity &&
175
+ score == o.score &&
176
+ classification_outcome == o.classification_outcome
177
+ end
178
+
179
+ # @see the `==` method
180
+ # @param [Object] Object to be compared
181
+ def eql?(o)
182
+ self == o
183
+ end
184
+
185
+ # Calculates hash code according to all attributes.
186
+ # @return [Fixnum] Hash code
187
+ def hash
188
+ [successful, clean_result, contains_nudity, contains_graphic_violence, contains_non_graphic_violence, contains_self_harm, contains_hate, contains_potential_illegal_activity, contains_medical_imagery, contains_profanity, score, classification_outcome].hash
189
+ end
190
+
191
+ # Builds the object from hash
192
+ # @param [Hash] attributes Model attributes in the form of hash
193
+ # @return [Object] Returns the model itself
194
+ def build_from_hash(attributes)
195
+ return nil unless attributes.is_a?(Hash)
196
+ self.class.swagger_types.each_pair do |key, type|
197
+ if type =~ /\AArray<(.*)>/i
198
+ # check to ensure the input is an array given that the attribute
199
+ # is documented as an array but the input is not
200
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
201
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
202
+ end
203
+ elsif !attributes[self.class.attribute_map[key]].nil?
204
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
205
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
206
+ end
207
+
208
+ self
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param string type Data type
213
+ # @param string value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def _deserialize(type, value)
216
+ case type.to_sym
217
+ when :DateTime
218
+ DateTime.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :BOOLEAN
228
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
249
+ temp_model.build_from_hash(value)
250
+ end
251
+ end
252
+
253
+ # Returns the string representation of the object
254
+ # @return [String] String presentation of the object
255
+ def to_s
256
+ to_hash.to_s
257
+ end
258
+
259
+ # to_body is an alias to to_hash (backward compatibility)
260
+ # @return [Hash] Returns the object in the form of hash
261
+ def to_body
262
+ to_hash
263
+ end
264
+
265
+ # Returns the object in the form of hash
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_hash
268
+ hash = {}
269
+ self.class.attribute_map.each_pair do |attr, param|
270
+ value = self.send(attr)
271
+ next if value.nil?
272
+ hash[param] = _to_hash(value)
273
+ end
274
+ hash
275
+ end
276
+
277
+ # Outputs non-array value in the form of hash
278
+ # For object, use to_hash. Otherwise, just return the value
279
+ # @param [Object] value Any valid value
280
+ # @return [Hash] Returns the value in the form of hash
281
+ def _to_hash(value)
282
+ if value.is_a?(Array)
283
+ value.compact.map { |v| _to_hash(v) }
284
+ elsif value.is_a?(Hash)
285
+ {}.tap do |hash|
286
+ value.each { |k, v| hash[k] = _to_hash(v) }
287
+ end
288
+ elsif value.respond_to? :to_hash
289
+ value.to_hash
290
+ else
291
+ value
292
+ end
293
+ end
294
+
295
+ end
296
+ end
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #imageapi
3
3
 
4
- #Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
4
+ #Image Recognition and Processing APIs let you use Artificial Intelligence and Machine Learning to recognize and process images, and also perform useful image modification operations.
5
5
 
6
6
  OpenAPI spec version: v1
7
7