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.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/README.md +184 -0
- data/Rakefile +8 -0
- data/cloudmersive-image-recognition-api-client.gemspec +45 -0
- data/docs/AgeDetectionResult.md +10 -0
- data/docs/ArtisticApi.md +66 -0
- data/docs/ColorResult.md +10 -0
- data/docs/ConvertApi.md +396 -0
- data/docs/DetectedLicensePlate.md +14 -0
- data/docs/DetectedObject.md +13 -0
- data/docs/DominantColorResult.md +9 -0
- data/docs/DrawPolygonInstance.md +11 -0
- data/docs/DrawPolygonRequest.md +10 -0
- data/docs/DrawRectangleInstance.md +14 -0
- data/docs/DrawRectangleRequest.md +10 -0
- data/docs/DrawTextInstance.md +15 -0
- data/docs/DrawTextRequest.md +10 -0
- data/docs/EditApi.md +704 -0
- data/docs/Face.md +11 -0
- data/docs/FaceApi.md +396 -0
- data/docs/FaceCompareResponse.md +11 -0
- data/docs/FaceLocateResponse.md +11 -0
- data/docs/FaceLocateWithLandmarksResponse.md +11 -0
- data/docs/FaceMatch.md +13 -0
- data/docs/FacePoint.md +9 -0
- data/docs/FaceWithLandmarks.md +20 -0
- data/docs/FilterApi.md +478 -0
- data/docs/FindSymbolResult.md +13 -0
- data/docs/FineTextDetectionResult.md +10 -0
- data/docs/FineTextItem.md +18 -0
- data/docs/GenderDetectionResult.md +10 -0
- data/docs/ImageDescriptionResponse.md +11 -0
- data/docs/ImageMetadata.md +17 -0
- data/docs/ImageMetadataExifValue.md +10 -0
- data/docs/InfoApi.md +118 -0
- data/docs/NsfwApi.md +63 -0
- data/docs/NsfwResult.md +10 -0
- data/docs/ObjectDetectionResult.md +10 -0
- data/docs/PersonWithAge.md +11 -0
- data/docs/PersonWithGender.md +10 -0
- data/docs/PolygonPoint.md +9 -0
- data/docs/RecognitionOutcome.md +9 -0
- data/docs/RecognizeApi.md +455 -0
- data/docs/ResizeApi.md +130 -0
- data/docs/TextDetectionResult.md +10 -0
- data/docs/TextItem.md +11 -0
- data/docs/VehicleLicensePlateDetectionResult.md +10 -0
- data/git_push.sh +55 -0
- data/lib/cloudmersive-image-recognition-api-client.rb +82 -0
- data/lib/cloudmersive-image-recognition-api-client/api/artistic_api.rb +84 -0
- data/lib/cloudmersive-image-recognition-api-client/api/convert_api.rb +414 -0
- data/lib/cloudmersive-image-recognition-api-client/api/edit_api.rb +753 -0
- data/lib/cloudmersive-image-recognition-api-client/api/face_api.rb +415 -0
- data/lib/cloudmersive-image-recognition-api-client/api/filter_api.rb +525 -0
- data/lib/cloudmersive-image-recognition-api-client/api/info_api.rb +133 -0
- data/lib/cloudmersive-image-recognition-api-client/api/nsfw_api.rb +78 -0
- data/lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb +473 -0
- data/lib/cloudmersive-image-recognition-api-client/api/resize_api.rb +157 -0
- data/lib/cloudmersive-image-recognition-api-client/api_client.rb +391 -0
- data/lib/cloudmersive-image-recognition-api-client/api_error.rb +38 -0
- data/lib/cloudmersive-image-recognition-api-client/configuration.rb +209 -0
- data/lib/cloudmersive-image-recognition-api-client/models/age_detection_result.rb +208 -0
- data/lib/cloudmersive-image-recognition-api-client/models/color_result.rb +206 -0
- data/lib/cloudmersive-image-recognition-api-client/models/detected_license_plate.rb +246 -0
- data/lib/cloudmersive-image-recognition-api-client/models/detected_object.rb +236 -0
- data/lib/cloudmersive-image-recognition-api-client/models/dominant_color_result.rb +198 -0
- data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_instance.rb +218 -0
- data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_request.rb +223 -0
- data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_instance.rb +246 -0
- data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_request.rb +223 -0
- data/lib/cloudmersive-image-recognition-api-client/models/draw_text_instance.rb +256 -0
- data/lib/cloudmersive-image-recognition-api-client/models/draw_text_request.rb +223 -0
- data/lib/cloudmersive-image-recognition-api-client/models/face.rb +216 -0
- data/lib/cloudmersive-image-recognition-api-client/models/face_compare_response.rb +218 -0
- data/lib/cloudmersive-image-recognition-api-client/models/face_locate_response.rb +218 -0
- data/lib/cloudmersive-image-recognition-api-client/models/face_locate_with_landmarks_response.rb +218 -0
- data/lib/cloudmersive-image-recognition-api-client/models/face_match.rb +236 -0
- data/lib/cloudmersive-image-recognition-api-client/models/face_point.rb +196 -0
- data/lib/cloudmersive-image-recognition-api-client/models/face_with_landmarks.rb +324 -0
- data/lib/cloudmersive-image-recognition-api-client/models/find_symbol_result.rb +236 -0
- data/lib/cloudmersive-image-recognition-api-client/models/fine_text_detection_result.rb +208 -0
- data/lib/cloudmersive-image-recognition-api-client/models/fine_text_item.rb +286 -0
- data/lib/cloudmersive-image-recognition-api-client/models/gender_detection_result.rb +208 -0
- data/lib/cloudmersive-image-recognition-api-client/models/image_description_response.rb +216 -0
- data/lib/cloudmersive-image-recognition-api-client/models/image_metadata.rb +278 -0
- data/lib/cloudmersive-image-recognition-api-client/models/image_metadata_exif_value.rb +206 -0
- data/lib/cloudmersive-image-recognition-api-client/models/nsfw_result.rb +206 -0
- data/lib/cloudmersive-image-recognition-api-client/models/object_detection_result.rb +208 -0
- data/lib/cloudmersive-image-recognition-api-client/models/person_with_age.rb +215 -0
- data/lib/cloudmersive-image-recognition-api-client/models/person_with_gender.rb +206 -0
- data/lib/cloudmersive-image-recognition-api-client/models/polygon_point.rb +196 -0
- data/lib/cloudmersive-image-recognition-api-client/models/recognition_outcome.rb +196 -0
- data/lib/cloudmersive-image-recognition-api-client/models/text_detection_result.rb +208 -0
- data/lib/cloudmersive-image-recognition-api-client/models/text_item.rb +216 -0
- data/lib/cloudmersive-image-recognition-api-client/models/vehicle_license_plate_detection_result.rb +208 -0
- data/lib/cloudmersive-image-recognition-api-client/version.rb +15 -0
- data/spec/api/artistic_api_spec.rb +48 -0
- data/spec/api/convert_api_spec.rb +120 -0
- data/spec/api/edit_api_spec.rb +191 -0
- data/spec/api/face_api_spec.rb +120 -0
- data/spec/api/filter_api_spec.rb +141 -0
- data/spec/api/info_api_spec.rb +59 -0
- data/spec/api/nsfw_api_spec.rb +47 -0
- data/spec/api/recognize_api_spec.rb +133 -0
- data/spec/api/resize_api_spec.rb +63 -0
- data/spec/api_client_spec.rb +243 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/age_detection_result_spec.rb +53 -0
- data/spec/models/color_result_spec.rb +53 -0
- data/spec/models/detected_license_plate_spec.rb +77 -0
- data/spec/models/detected_object_spec.rb +71 -0
- data/spec/models/dominant_color_result_spec.rb +47 -0
- data/spec/models/draw_polygon_instance_spec.rb +59 -0
- data/spec/models/draw_polygon_request_spec.rb +53 -0
- data/spec/models/draw_rectangle_instance_spec.rb +77 -0
- data/spec/models/draw_rectangle_request_spec.rb +53 -0
- data/spec/models/draw_text_instance_spec.rb +83 -0
- data/spec/models/draw_text_request_spec.rb +53 -0
- data/spec/models/face_compare_response_spec.rb +59 -0
- data/spec/models/face_locate_response_spec.rb +59 -0
- data/spec/models/face_locate_with_landmarks_response_spec.rb +59 -0
- data/spec/models/face_match_spec.rb +71 -0
- data/spec/models/face_point_spec.rb +47 -0
- data/spec/models/face_spec.rb +59 -0
- data/spec/models/face_with_landmarks_spec.rb +113 -0
- data/spec/models/find_symbol_result_spec.rb +71 -0
- data/spec/models/fine_text_detection_result_spec.rb +53 -0
- data/spec/models/fine_text_item_spec.rb +101 -0
- data/spec/models/gender_detection_result_spec.rb +53 -0
- data/spec/models/image_description_response_spec.rb +59 -0
- data/spec/models/image_metadata_exif_value_spec.rb +53 -0
- data/spec/models/image_metadata_spec.rb +95 -0
- data/spec/models/nsfw_result_spec.rb +53 -0
- data/spec/models/object_detection_result_spec.rb +53 -0
- data/spec/models/person_with_age_spec.rb +59 -0
- data/spec/models/person_with_gender_spec.rb +53 -0
- data/spec/models/polygon_point_spec.rb +47 -0
- data/spec/models/recognition_outcome_spec.rb +47 -0
- data/spec/models/text_detection_result_spec.rb +53 -0
- data/spec/models/text_item_spec.rb +59 -0
- data/spec/models/vehicle_license_plate_detection_result_spec.rb +53 -0
- data/spec/spec_helper.rb +111 -0
- metadata +145 -3
@@ -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
|
+
# Point location within a face
|
17
|
+
class FacePoint
|
18
|
+
# X location, where 0 is the left-most pixel
|
19
|
+
attr_accessor :x
|
20
|
+
|
21
|
+
# Y location, where 0 is the top-most pixel
|
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' => :'Integer',
|
36
|
+
:'y' => :'Integer'
|
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
|
@@ -0,0 +1,324 @@
|
|
1
|
+
=begin
|
2
|
+
#imageapi
|
3
|
+
|
4
|
+
#Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveImageRecognitionApiClient
|
16
|
+
# Location of one face in an image
|
17
|
+
class FaceWithLandmarks
|
18
|
+
# X coordinate of the left side of the face
|
19
|
+
attr_accessor :left_x
|
20
|
+
|
21
|
+
# Y coordinate of the top side of the face
|
22
|
+
attr_accessor :top_y
|
23
|
+
|
24
|
+
# X coordinate of the right side of the face
|
25
|
+
attr_accessor :right_x
|
26
|
+
|
27
|
+
# Y coordinate of the bottom side of the face
|
28
|
+
attr_accessor :bottom_y
|
29
|
+
|
30
|
+
# Point locations of the left eyebrow (the eyebrow cloesest to the left side of the picture)
|
31
|
+
attr_accessor :left_eyebrow
|
32
|
+
|
33
|
+
# Point locations of the right eyebrow (the eyebrow cloesest to the right side of the picture)
|
34
|
+
attr_accessor :right_eyebrow
|
35
|
+
|
36
|
+
# Point locations of the left eye (the eye closest to the left side of the picture)
|
37
|
+
attr_accessor :left_eye
|
38
|
+
|
39
|
+
# Point locations of the right eye (the eye closest to the right side of the picture)
|
40
|
+
attr_accessor :right_eye
|
41
|
+
|
42
|
+
# Point locations of the bottom and sides of the face (cheeks and chin)
|
43
|
+
attr_accessor :bottom_and_sides_of_face
|
44
|
+
|
45
|
+
# Point locations of the nose bridge (the vertical portion of the nose)
|
46
|
+
attr_accessor :nose_bridge
|
47
|
+
|
48
|
+
# Point locations of the bottom (nostrils) of the nose
|
49
|
+
attr_accessor :nose_bottom
|
50
|
+
|
51
|
+
# Point locations of the inner outline of the lips
|
52
|
+
attr_accessor :lips_inner_outline
|
53
|
+
|
54
|
+
# Point locations of the outer outline of the lips
|
55
|
+
attr_accessor :lips_outer_outline
|
56
|
+
|
57
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
58
|
+
def self.attribute_map
|
59
|
+
{
|
60
|
+
:'left_x' => :'LeftX',
|
61
|
+
:'top_y' => :'TopY',
|
62
|
+
:'right_x' => :'RightX',
|
63
|
+
:'bottom_y' => :'BottomY',
|
64
|
+
:'left_eyebrow' => :'LeftEyebrow',
|
65
|
+
:'right_eyebrow' => :'RightEyebrow',
|
66
|
+
:'left_eye' => :'LeftEye',
|
67
|
+
:'right_eye' => :'RightEye',
|
68
|
+
:'bottom_and_sides_of_face' => :'BottomAndSidesOfFace',
|
69
|
+
:'nose_bridge' => :'NoseBridge',
|
70
|
+
:'nose_bottom' => :'NoseBottom',
|
71
|
+
:'lips_inner_outline' => :'LipsInnerOutline',
|
72
|
+
:'lips_outer_outline' => :'LipsOuterOutline'
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
# Attribute type mapping.
|
77
|
+
def self.swagger_types
|
78
|
+
{
|
79
|
+
:'left_x' => :'Integer',
|
80
|
+
:'top_y' => :'Integer',
|
81
|
+
:'right_x' => :'Integer',
|
82
|
+
:'bottom_y' => :'Integer',
|
83
|
+
:'left_eyebrow' => :'Array<FacePoint>',
|
84
|
+
:'right_eyebrow' => :'Array<FacePoint>',
|
85
|
+
:'left_eye' => :'Array<FacePoint>',
|
86
|
+
:'right_eye' => :'Array<FacePoint>',
|
87
|
+
:'bottom_and_sides_of_face' => :'Array<FacePoint>',
|
88
|
+
:'nose_bridge' => :'Array<FacePoint>',
|
89
|
+
:'nose_bottom' => :'Array<FacePoint>',
|
90
|
+
:'lips_inner_outline' => :'Array<FacePoint>',
|
91
|
+
:'lips_outer_outline' => :'Array<FacePoint>'
|
92
|
+
}
|
93
|
+
end
|
94
|
+
|
95
|
+
# Initializes the object
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
def initialize(attributes = {})
|
98
|
+
return unless attributes.is_a?(Hash)
|
99
|
+
|
100
|
+
# convert string to symbol for hash key
|
101
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
102
|
+
|
103
|
+
if attributes.has_key?(:'LeftX')
|
104
|
+
self.left_x = attributes[:'LeftX']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.has_key?(:'TopY')
|
108
|
+
self.top_y = attributes[:'TopY']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.has_key?(:'RightX')
|
112
|
+
self.right_x = attributes[:'RightX']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.has_key?(:'BottomY')
|
116
|
+
self.bottom_y = attributes[:'BottomY']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.has_key?(:'LeftEyebrow')
|
120
|
+
if (value = attributes[:'LeftEyebrow']).is_a?(Array)
|
121
|
+
self.left_eyebrow = value
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'RightEyebrow')
|
126
|
+
if (value = attributes[:'RightEyebrow']).is_a?(Array)
|
127
|
+
self.right_eyebrow = value
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.has_key?(:'LeftEye')
|
132
|
+
if (value = attributes[:'LeftEye']).is_a?(Array)
|
133
|
+
self.left_eye = value
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.has_key?(:'RightEye')
|
138
|
+
if (value = attributes[:'RightEye']).is_a?(Array)
|
139
|
+
self.right_eye = value
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.has_key?(:'BottomAndSidesOfFace')
|
144
|
+
if (value = attributes[:'BottomAndSidesOfFace']).is_a?(Array)
|
145
|
+
self.bottom_and_sides_of_face = value
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.has_key?(:'NoseBridge')
|
150
|
+
if (value = attributes[:'NoseBridge']).is_a?(Array)
|
151
|
+
self.nose_bridge = value
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
if attributes.has_key?(:'NoseBottom')
|
156
|
+
if (value = attributes[:'NoseBottom']).is_a?(Array)
|
157
|
+
self.nose_bottom = value
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.has_key?(:'LipsInnerOutline')
|
162
|
+
if (value = attributes[:'LipsInnerOutline']).is_a?(Array)
|
163
|
+
self.lips_inner_outline = value
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
if attributes.has_key?(:'LipsOuterOutline')
|
168
|
+
if (value = attributes[:'LipsOuterOutline']).is_a?(Array)
|
169
|
+
self.lips_outer_outline = value
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
175
|
+
# @return Array for valid properties with the reasons
|
176
|
+
def list_invalid_properties
|
177
|
+
invalid_properties = Array.new
|
178
|
+
invalid_properties
|
179
|
+
end
|
180
|
+
|
181
|
+
# Check to see if the all the properties in the model are valid
|
182
|
+
# @return true if the model is valid
|
183
|
+
def valid?
|
184
|
+
true
|
185
|
+
end
|
186
|
+
|
187
|
+
# Checks equality by comparing each attribute.
|
188
|
+
# @param [Object] Object to be compared
|
189
|
+
def ==(o)
|
190
|
+
return true if self.equal?(o)
|
191
|
+
self.class == o.class &&
|
192
|
+
left_x == o.left_x &&
|
193
|
+
top_y == o.top_y &&
|
194
|
+
right_x == o.right_x &&
|
195
|
+
bottom_y == o.bottom_y &&
|
196
|
+
left_eyebrow == o.left_eyebrow &&
|
197
|
+
right_eyebrow == o.right_eyebrow &&
|
198
|
+
left_eye == o.left_eye &&
|
199
|
+
right_eye == o.right_eye &&
|
200
|
+
bottom_and_sides_of_face == o.bottom_and_sides_of_face &&
|
201
|
+
nose_bridge == o.nose_bridge &&
|
202
|
+
nose_bottom == o.nose_bottom &&
|
203
|
+
lips_inner_outline == o.lips_inner_outline &&
|
204
|
+
lips_outer_outline == o.lips_outer_outline
|
205
|
+
end
|
206
|
+
|
207
|
+
# @see the `==` method
|
208
|
+
# @param [Object] Object to be compared
|
209
|
+
def eql?(o)
|
210
|
+
self == o
|
211
|
+
end
|
212
|
+
|
213
|
+
# Calculates hash code according to all attributes.
|
214
|
+
# @return [Fixnum] Hash code
|
215
|
+
def hash
|
216
|
+
[left_x, top_y, right_x, bottom_y, left_eyebrow, right_eyebrow, left_eye, right_eye, bottom_and_sides_of_face, nose_bridge, nose_bottom, lips_inner_outline, lips_outer_outline].hash
|
217
|
+
end
|
218
|
+
|
219
|
+
# Builds the object from hash
|
220
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
221
|
+
# @return [Object] Returns the model itself
|
222
|
+
def build_from_hash(attributes)
|
223
|
+
return nil unless attributes.is_a?(Hash)
|
224
|
+
self.class.swagger_types.each_pair do |key, type|
|
225
|
+
if type =~ /\AArray<(.*)>/i
|
226
|
+
# check to ensure the input is an array given that the attribute
|
227
|
+
# is documented as an array but the input is not
|
228
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
229
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
230
|
+
end
|
231
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
232
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
233
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
234
|
+
end
|
235
|
+
|
236
|
+
self
|
237
|
+
end
|
238
|
+
|
239
|
+
# Deserializes the data based on type
|
240
|
+
# @param string type Data type
|
241
|
+
# @param string value Value to be deserialized
|
242
|
+
# @return [Object] Deserialized data
|
243
|
+
def _deserialize(type, value)
|
244
|
+
case type.to_sym
|
245
|
+
when :DateTime
|
246
|
+
DateTime.parse(value)
|
247
|
+
when :Date
|
248
|
+
Date.parse(value)
|
249
|
+
when :String
|
250
|
+
value.to_s
|
251
|
+
when :Integer
|
252
|
+
value.to_i
|
253
|
+
when :Float
|
254
|
+
value.to_f
|
255
|
+
when :BOOLEAN
|
256
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
257
|
+
true
|
258
|
+
else
|
259
|
+
false
|
260
|
+
end
|
261
|
+
when :Object
|
262
|
+
# generic object (usually a Hash), return directly
|
263
|
+
value
|
264
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
265
|
+
inner_type = Regexp.last_match[:inner_type]
|
266
|
+
value.map { |v| _deserialize(inner_type, v) }
|
267
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
268
|
+
k_type = Regexp.last_match[:k_type]
|
269
|
+
v_type = Regexp.last_match[:v_type]
|
270
|
+
{}.tap do |hash|
|
271
|
+
value.each do |k, v|
|
272
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
else # model
|
276
|
+
temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
|
277
|
+
temp_model.build_from_hash(value)
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
# Returns the string representation of the object
|
282
|
+
# @return [String] String presentation of the object
|
283
|
+
def to_s
|
284
|
+
to_hash.to_s
|
285
|
+
end
|
286
|
+
|
287
|
+
# to_body is an alias to to_hash (backward compatibility)
|
288
|
+
# @return [Hash] Returns the object in the form of hash
|
289
|
+
def to_body
|
290
|
+
to_hash
|
291
|
+
end
|
292
|
+
|
293
|
+
# Returns the object in the form of hash
|
294
|
+
# @return [Hash] Returns the object in the form of hash
|
295
|
+
def to_hash
|
296
|
+
hash = {}
|
297
|
+
self.class.attribute_map.each_pair do |attr, param|
|
298
|
+
value = self.send(attr)
|
299
|
+
next if value.nil?
|
300
|
+
hash[param] = _to_hash(value)
|
301
|
+
end
|
302
|
+
hash
|
303
|
+
end
|
304
|
+
|
305
|
+
# Outputs non-array value in the form of hash
|
306
|
+
# For object, use to_hash. Otherwise, just return the value
|
307
|
+
# @param [Object] value Any valid value
|
308
|
+
# @return [Hash] Returns the value in the form of hash
|
309
|
+
def _to_hash(value)
|
310
|
+
if value.is_a?(Array)
|
311
|
+
value.compact.map { |v| _to_hash(v) }
|
312
|
+
elsif value.is_a?(Hash)
|
313
|
+
{}.tap do |hash|
|
314
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
315
|
+
end
|
316
|
+
elsif value.respond_to? :to_hash
|
317
|
+
value.to_hash
|
318
|
+
else
|
319
|
+
value
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
end
|
324
|
+
end
|