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,215 @@
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 age classification operation
17
+ class PersonWithAge
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 age classification; possible values are between 0.0 and 1.0; higher is better, with values > 0.50 being high confidence results
22
+ attr_accessor :age_classification_confidence
23
+
24
+ # The person's age range classification result in years; possible values are \"0-2\", \"4-6\", \"8-13\", \"15-20\", \"25-32\", \"38-43\", \"48-53\", \"60+\"
25
+ attr_accessor :age_class
26
+
27
+ attr_accessor :age
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'face_location' => :'FaceLocation',
33
+ :'age_classification_confidence' => :'AgeClassificationConfidence',
34
+ :'age_class' => :'AgeClass',
35
+ :'age' => :'Age'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ :'face_location' => :'Face',
43
+ :'age_classification_confidence' => :'Float',
44
+ :'age_class' => :'String',
45
+ :'age' => :'Float'
46
+ }
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ return unless attributes.is_a?(Hash)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
+
57
+ if attributes.has_key?(:'FaceLocation')
58
+ self.face_location = attributes[:'FaceLocation']
59
+ end
60
+
61
+ if attributes.has_key?(:'AgeClassificationConfidence')
62
+ self.age_classification_confidence = attributes[:'AgeClassificationConfidence']
63
+ end
64
+
65
+ if attributes.has_key?(:'AgeClass')
66
+ self.age_class = attributes[:'AgeClass']
67
+ end
68
+
69
+ if attributes.has_key?(:'Age')
70
+ self.age = attributes[:'Age']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ 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
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ face_location == o.face_location &&
93
+ age_classification_confidence == o.age_classification_confidence &&
94
+ age_class == o.age_class &&
95
+ age == o.age
96
+ end
97
+
98
+ # @see the `==` method
99
+ # @param [Object] Object to be compared
100
+ def eql?(o)
101
+ self == o
102
+ end
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Fixnum] Hash code
106
+ def hash
107
+ [face_location, age_classification_confidence, age_class, age].hash
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.swagger_types.each_pair do |key, type|
116
+ if type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ DateTime.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :BOOLEAN
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
168
+ temp_model.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ next if value.nil?
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+
214
+ end
215
+ end
@@ -0,0 +1,206 @@
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
@@ -0,0 +1,196 @@
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
+ # One point in a polygon
17
+ class PolygonPoint
18
+ # X location in pixels of this point in the polygon
19
+ attr_accessor :x
20
+
21
+ # Y location in pixels of this point in the polygon
22
+ attr_accessor :y
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'x' => :'X',
28
+ :'y' => :'Y'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'x' => :'Float',
36
+ :'y' => :'Float'
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?(:'X')
49
+ self.x = attributes[:'X']
50
+ end
51
+
52
+ if attributes.has_key?(:'Y')
53
+ self.y = attributes[:'Y']
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
+ x == o.x &&
76
+ y == o.y
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
+ [x, y].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