cloudmersive-image-recognition-api-client 1.4.6 → 2.0.1
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.
- checksums.yaml +4 -4
- metadata +3 -145
- data/Gemfile +0 -7
- data/README.md +0 -184
- data/Rakefile +0 -8
- data/cloudmersive-image-recognition-api-client.gemspec +0 -45
- data/docs/AgeDetectionResult.md +0 -10
- data/docs/ArtisticApi.md +0 -66
- data/docs/ColorResult.md +0 -10
- data/docs/ConvertApi.md +0 -396
- data/docs/DetectedLicensePlate.md +0 -14
- data/docs/DetectedObject.md +0 -13
- data/docs/DominantColorResult.md +0 -9
- data/docs/DrawPolygonInstance.md +0 -11
- data/docs/DrawPolygonRequest.md +0 -10
- data/docs/DrawRectangleInstance.md +0 -14
- data/docs/DrawRectangleRequest.md +0 -10
- data/docs/DrawTextInstance.md +0 -15
- data/docs/DrawTextRequest.md +0 -10
- data/docs/EditApi.md +0 -704
- data/docs/Face.md +0 -11
- data/docs/FaceApi.md +0 -396
- data/docs/FaceCompareResponse.md +0 -11
- data/docs/FaceLocateResponse.md +0 -11
- data/docs/FaceLocateWithLandmarksResponse.md +0 -11
- data/docs/FaceMatch.md +0 -13
- data/docs/FacePoint.md +0 -9
- data/docs/FaceWithLandmarks.md +0 -20
- data/docs/FilterApi.md +0 -478
- data/docs/FindSymbolResult.md +0 -13
- data/docs/FineTextDetectionResult.md +0 -10
- data/docs/FineTextItem.md +0 -18
- data/docs/GenderDetectionResult.md +0 -10
- data/docs/ImageDescriptionResponse.md +0 -11
- data/docs/ImageMetadata.md +0 -17
- data/docs/ImageMetadataExifValue.md +0 -10
- data/docs/InfoApi.md +0 -118
- data/docs/NsfwApi.md +0 -63
- data/docs/NsfwResult.md +0 -10
- data/docs/ObjectDetectionResult.md +0 -10
- data/docs/PersonWithAge.md +0 -11
- data/docs/PersonWithGender.md +0 -10
- data/docs/PolygonPoint.md +0 -9
- data/docs/RecognitionOutcome.md +0 -9
- data/docs/RecognizeApi.md +0 -455
- data/docs/ResizeApi.md +0 -130
- data/docs/TextDetectionResult.md +0 -10
- data/docs/TextItem.md +0 -11
- data/docs/VehicleLicensePlateDetectionResult.md +0 -10
- data/git_push.sh +0 -55
- data/lib/cloudmersive-image-recognition-api-client.rb +0 -82
- data/lib/cloudmersive-image-recognition-api-client/api/artistic_api.rb +0 -85
- data/lib/cloudmersive-image-recognition-api-client/api/convert_api.rb +0 -421
- data/lib/cloudmersive-image-recognition-api-client/api/edit_api.rb +0 -765
- data/lib/cloudmersive-image-recognition-api-client/api/face_api.rb +0 -422
- data/lib/cloudmersive-image-recognition-api-client/api/filter_api.rb +0 -533
- data/lib/cloudmersive-image-recognition-api-client/api/info_api.rb +0 -135
- data/lib/cloudmersive-image-recognition-api-client/api/nsfw_api.rb +0 -79
- data/lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb +0 -481
- data/lib/cloudmersive-image-recognition-api-client/api/resize_api.rb +0 -159
- data/lib/cloudmersive-image-recognition-api-client/api_client.rb +0 -389
- data/lib/cloudmersive-image-recognition-api-client/api_error.rb +0 -38
- data/lib/cloudmersive-image-recognition-api-client/configuration.rb +0 -209
- data/lib/cloudmersive-image-recognition-api-client/models/age_detection_result.rb +0 -211
- data/lib/cloudmersive-image-recognition-api-client/models/color_result.rb +0 -209
- data/lib/cloudmersive-image-recognition-api-client/models/detected_license_plate.rb +0 -249
- data/lib/cloudmersive-image-recognition-api-client/models/detected_object.rb +0 -239
- data/lib/cloudmersive-image-recognition-api-client/models/dominant_color_result.rb +0 -201
- data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_instance.rb +0 -221
- data/lib/cloudmersive-image-recognition-api-client/models/draw_polygon_request.rb +0 -227
- data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_instance.rb +0 -249
- data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_request.rb +0 -227
- data/lib/cloudmersive-image-recognition-api-client/models/draw_text_instance.rb +0 -259
- data/lib/cloudmersive-image-recognition-api-client/models/draw_text_request.rb +0 -227
- data/lib/cloudmersive-image-recognition-api-client/models/face.rb +0 -219
- data/lib/cloudmersive-image-recognition-api-client/models/face_compare_response.rb +0 -221
- data/lib/cloudmersive-image-recognition-api-client/models/face_locate_response.rb +0 -221
- data/lib/cloudmersive-image-recognition-api-client/models/face_locate_with_landmarks_response.rb +0 -221
- data/lib/cloudmersive-image-recognition-api-client/models/face_match.rb +0 -239
- data/lib/cloudmersive-image-recognition-api-client/models/face_point.rb +0 -199
- data/lib/cloudmersive-image-recognition-api-client/models/face_with_landmarks.rb +0 -327
- data/lib/cloudmersive-image-recognition-api-client/models/find_symbol_result.rb +0 -239
- data/lib/cloudmersive-image-recognition-api-client/models/fine_text_detection_result.rb +0 -211
- data/lib/cloudmersive-image-recognition-api-client/models/fine_text_item.rb +0 -289
- data/lib/cloudmersive-image-recognition-api-client/models/gender_detection_result.rb +0 -211
- data/lib/cloudmersive-image-recognition-api-client/models/image_description_response.rb +0 -219
- data/lib/cloudmersive-image-recognition-api-client/models/image_metadata.rb +0 -281
- data/lib/cloudmersive-image-recognition-api-client/models/image_metadata_exif_value.rb +0 -209
- data/lib/cloudmersive-image-recognition-api-client/models/nsfw_result.rb +0 -209
- data/lib/cloudmersive-image-recognition-api-client/models/object_detection_result.rb +0 -211
- data/lib/cloudmersive-image-recognition-api-client/models/person_with_age.rb +0 -218
- data/lib/cloudmersive-image-recognition-api-client/models/person_with_gender.rb +0 -209
- data/lib/cloudmersive-image-recognition-api-client/models/polygon_point.rb +0 -199
- data/lib/cloudmersive-image-recognition-api-client/models/recognition_outcome.rb +0 -199
- data/lib/cloudmersive-image-recognition-api-client/models/text_detection_result.rb +0 -211
- data/lib/cloudmersive-image-recognition-api-client/models/text_item.rb +0 -219
- data/lib/cloudmersive-image-recognition-api-client/models/vehicle_license_plate_detection_result.rb +0 -211
- data/lib/cloudmersive-image-recognition-api-client/version.rb +0 -15
- data/spec/api/artistic_api_spec.rb +0 -48
- data/spec/api/convert_api_spec.rb +0 -120
- data/spec/api/edit_api_spec.rb +0 -191
- data/spec/api/face_api_spec.rb +0 -120
- data/spec/api/filter_api_spec.rb +0 -141
- data/spec/api/info_api_spec.rb +0 -59
- data/spec/api/nsfw_api_spec.rb +0 -47
- data/spec/api/recognize_api_spec.rb +0 -133
- data/spec/api/resize_api_spec.rb +0 -63
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/age_detection_result_spec.rb +0 -54
- data/spec/models/color_result_spec.rb +0 -54
- data/spec/models/detected_license_plate_spec.rb +0 -78
- data/spec/models/detected_object_spec.rb +0 -72
- data/spec/models/dominant_color_result_spec.rb +0 -48
- data/spec/models/draw_polygon_instance_spec.rb +0 -60
- data/spec/models/draw_polygon_request_spec.rb +0 -54
- data/spec/models/draw_rectangle_instance_spec.rb +0 -78
- data/spec/models/draw_rectangle_request_spec.rb +0 -54
- data/spec/models/draw_text_instance_spec.rb +0 -84
- data/spec/models/draw_text_request_spec.rb +0 -54
- data/spec/models/face_compare_response_spec.rb +0 -60
- data/spec/models/face_locate_response_spec.rb +0 -60
- data/spec/models/face_locate_with_landmarks_response_spec.rb +0 -60
- data/spec/models/face_match_spec.rb +0 -72
- data/spec/models/face_point_spec.rb +0 -48
- data/spec/models/face_spec.rb +0 -60
- data/spec/models/face_with_landmarks_spec.rb +0 -114
- data/spec/models/find_symbol_result_spec.rb +0 -72
- data/spec/models/fine_text_detection_result_spec.rb +0 -54
- data/spec/models/fine_text_item_spec.rb +0 -102
- data/spec/models/gender_detection_result_spec.rb +0 -54
- data/spec/models/image_description_response_spec.rb +0 -60
- data/spec/models/image_metadata_exif_value_spec.rb +0 -54
- data/spec/models/image_metadata_spec.rb +0 -96
- data/spec/models/nsfw_result_spec.rb +0 -54
- data/spec/models/object_detection_result_spec.rb +0 -54
- data/spec/models/person_with_age_spec.rb +0 -60
- data/spec/models/person_with_gender_spec.rb +0 -54
- data/spec/models/polygon_point_spec.rb +0 -48
- data/spec/models/recognition_outcome_spec.rb +0 -48
- data/spec/models/text_detection_result_spec.rb +0 -54
- data/spec/models/text_item_spec.rb +0 -60
- data/spec/models/vehicle_license_plate_detection_result_spec.rb +0 -54
- data/spec/spec_helper.rb +0 -111
@@ -1,227 +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.3.1
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module CloudmersiveImageRecognitionApiClient
|
16
|
-
# Request to draw one or more polygons on a base image
|
17
|
-
class DrawPolygonRequest
|
18
|
-
# Image to draw polygons on, in bytes. You can also use the BaseImageUrl instead to supply image input as a URL
|
19
|
-
attr_accessor :base_image_bytes
|
20
|
-
|
21
|
-
# Image to draw polygons on, as an HTTP or HTTPS fully-qualified URL
|
22
|
-
attr_accessor :base_image_url
|
23
|
-
|
24
|
-
# Polygons to draw on the image. Polygons are drawn in index order.
|
25
|
-
attr_accessor :polygons_to_draw
|
26
|
-
|
27
|
-
|
28
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
-
def self.attribute_map
|
30
|
-
{
|
31
|
-
:'base_image_bytes' => :'BaseImageBytes',
|
32
|
-
:'base_image_url' => :'BaseImageUrl',
|
33
|
-
:'polygons_to_draw' => :'PolygonsToDraw'
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
|
-
# Attribute type mapping.
|
38
|
-
def self.swagger_types
|
39
|
-
{
|
40
|
-
:'base_image_bytes' => :'String',
|
41
|
-
:'base_image_url' => :'String',
|
42
|
-
:'polygons_to_draw' => :'Array<DrawPolygonInstance>'
|
43
|
-
}
|
44
|
-
end
|
45
|
-
|
46
|
-
# Initializes the object
|
47
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
-
def initialize(attributes = {})
|
49
|
-
return unless attributes.is_a?(Hash)
|
50
|
-
|
51
|
-
# convert string to symbol for hash key
|
52
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
53
|
-
|
54
|
-
if attributes.has_key?(:'BaseImageBytes')
|
55
|
-
self.base_image_bytes = attributes[:'BaseImageBytes']
|
56
|
-
end
|
57
|
-
|
58
|
-
if attributes.has_key?(:'BaseImageUrl')
|
59
|
-
self.base_image_url = attributes[:'BaseImageUrl']
|
60
|
-
end
|
61
|
-
|
62
|
-
if attributes.has_key?(:'PolygonsToDraw')
|
63
|
-
if (value = attributes[:'PolygonsToDraw']).is_a?(Array)
|
64
|
-
self.polygons_to_draw = value
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
-
# @return Array for valid properties with the reasons
|
72
|
-
def list_invalid_properties
|
73
|
-
invalid_properties = Array.new
|
74
|
-
if !@base_image_bytes.nil? && @base_image_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
75
|
-
invalid_properties.push("invalid value for 'base_image_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
|
76
|
-
end
|
77
|
-
|
78
|
-
return invalid_properties
|
79
|
-
end
|
80
|
-
|
81
|
-
# Check to see if the all the properties in the model are valid
|
82
|
-
# @return true if the model is valid
|
83
|
-
def valid?
|
84
|
-
return false if !@base_image_bytes.nil? && @base_image_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
85
|
-
return true
|
86
|
-
end
|
87
|
-
|
88
|
-
# Custom attribute writer method with validation
|
89
|
-
# @param [Object] base_image_bytes Value to be assigned
|
90
|
-
def base_image_bytes=(base_image_bytes)
|
91
|
-
|
92
|
-
if !base_image_bytes.nil? && base_image_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
93
|
-
fail ArgumentError, "invalid value for 'base_image_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
|
94
|
-
end
|
95
|
-
|
96
|
-
@base_image_bytes = base_image_bytes
|
97
|
-
end
|
98
|
-
|
99
|
-
# Checks equality by comparing each attribute.
|
100
|
-
# @param [Object] Object to be compared
|
101
|
-
def ==(o)
|
102
|
-
return true if self.equal?(o)
|
103
|
-
self.class == o.class &&
|
104
|
-
base_image_bytes == o.base_image_bytes &&
|
105
|
-
base_image_url == o.base_image_url &&
|
106
|
-
polygons_to_draw == o.polygons_to_draw
|
107
|
-
end
|
108
|
-
|
109
|
-
# @see the `==` method
|
110
|
-
# @param [Object] Object to be compared
|
111
|
-
def eql?(o)
|
112
|
-
self == o
|
113
|
-
end
|
114
|
-
|
115
|
-
# Calculates hash code according to all attributes.
|
116
|
-
# @return [Fixnum] Hash code
|
117
|
-
def hash
|
118
|
-
[base_image_bytes, base_image_url, polygons_to_draw].hash
|
119
|
-
end
|
120
|
-
|
121
|
-
# Builds the object from hash
|
122
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
123
|
-
# @return [Object] Returns the model itself
|
124
|
-
def build_from_hash(attributes)
|
125
|
-
return nil unless attributes.is_a?(Hash)
|
126
|
-
self.class.swagger_types.each_pair do |key, type|
|
127
|
-
if type =~ /\AArray<(.*)>/i
|
128
|
-
# check to ensure the input is an array given that the the attribute
|
129
|
-
# is documented as an array but the input is not
|
130
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
131
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
132
|
-
end
|
133
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
134
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
135
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
136
|
-
end
|
137
|
-
|
138
|
-
self
|
139
|
-
end
|
140
|
-
|
141
|
-
# Deserializes the data based on type
|
142
|
-
# @param string type Data type
|
143
|
-
# @param string value Value to be deserialized
|
144
|
-
# @return [Object] Deserialized data
|
145
|
-
def _deserialize(type, value)
|
146
|
-
case type.to_sym
|
147
|
-
when :DateTime
|
148
|
-
DateTime.parse(value)
|
149
|
-
when :Date
|
150
|
-
Date.parse(value)
|
151
|
-
when :String
|
152
|
-
value.to_s
|
153
|
-
when :Integer
|
154
|
-
value.to_i
|
155
|
-
when :Float
|
156
|
-
value.to_f
|
157
|
-
when :BOOLEAN
|
158
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
159
|
-
true
|
160
|
-
else
|
161
|
-
false
|
162
|
-
end
|
163
|
-
when :Object
|
164
|
-
# generic object (usually a Hash), return directly
|
165
|
-
value
|
166
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
167
|
-
inner_type = Regexp.last_match[:inner_type]
|
168
|
-
value.map { |v| _deserialize(inner_type, v) }
|
169
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
170
|
-
k_type = Regexp.last_match[:k_type]
|
171
|
-
v_type = Regexp.last_match[:v_type]
|
172
|
-
{}.tap do |hash|
|
173
|
-
value.each do |k, v|
|
174
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
else # model
|
178
|
-
temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
|
179
|
-
temp_model.build_from_hash(value)
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
# Returns the string representation of the object
|
184
|
-
# @return [String] String presentation of the object
|
185
|
-
def to_s
|
186
|
-
to_hash.to_s
|
187
|
-
end
|
188
|
-
|
189
|
-
# to_body is an alias to to_hash (backward compatibility)
|
190
|
-
# @return [Hash] Returns the object in the form of hash
|
191
|
-
def to_body
|
192
|
-
to_hash
|
193
|
-
end
|
194
|
-
|
195
|
-
# Returns the object in the form of hash
|
196
|
-
# @return [Hash] Returns the object in the form of hash
|
197
|
-
def to_hash
|
198
|
-
hash = {}
|
199
|
-
self.class.attribute_map.each_pair do |attr, param|
|
200
|
-
value = self.send(attr)
|
201
|
-
next if value.nil?
|
202
|
-
hash[param] = _to_hash(value)
|
203
|
-
end
|
204
|
-
hash
|
205
|
-
end
|
206
|
-
|
207
|
-
# Outputs non-array value in the form of hash
|
208
|
-
# For object, use to_hash. Otherwise, just return the value
|
209
|
-
# @param [Object] value Any valid value
|
210
|
-
# @return [Hash] Returns the value in the form of hash
|
211
|
-
def _to_hash(value)
|
212
|
-
if value.is_a?(Array)
|
213
|
-
value.compact.map{ |v| _to_hash(v) }
|
214
|
-
elsif value.is_a?(Hash)
|
215
|
-
{}.tap do |hash|
|
216
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
217
|
-
end
|
218
|
-
elsif value.respond_to? :to_hash
|
219
|
-
value.to_hash
|
220
|
-
else
|
221
|
-
value
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
end
|
226
|
-
|
227
|
-
end
|
@@ -1,249 +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.3.1
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module CloudmersiveImageRecognitionApiClient
|
16
|
-
# Rectangle instance to draw on an image
|
17
|
-
class DrawRectangleInstance
|
18
|
-
# Border Color to use - can be a hex value (with #) or HTML common color name. Transparent colors are supported.
|
19
|
-
attr_accessor :border_color
|
20
|
-
|
21
|
-
# Width in pixels of the border. Pass in 0 to draw a rectangle with no border
|
22
|
-
attr_accessor :border_width
|
23
|
-
|
24
|
-
# Fill Color to use - can be a hex value (with #) or HTML common color name. Transparent colors are supported. Leave blank to not fill the rectangle.
|
25
|
-
attr_accessor :fill_color
|
26
|
-
|
27
|
-
# Pixel location of the left edge of the rectangle location
|
28
|
-
attr_accessor :x
|
29
|
-
|
30
|
-
# Pixel location of the top edge of the rectangle location
|
31
|
-
attr_accessor :y
|
32
|
-
|
33
|
-
# Width in pixels of the rectangle
|
34
|
-
attr_accessor :width
|
35
|
-
|
36
|
-
# Height in pixels of the rectangle
|
37
|
-
attr_accessor :height
|
38
|
-
|
39
|
-
|
40
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
-
def self.attribute_map
|
42
|
-
{
|
43
|
-
:'border_color' => :'BorderColor',
|
44
|
-
:'border_width' => :'BorderWidth',
|
45
|
-
:'fill_color' => :'FillColor',
|
46
|
-
:'x' => :'X',
|
47
|
-
:'y' => :'Y',
|
48
|
-
:'width' => :'Width',
|
49
|
-
:'height' => :'Height'
|
50
|
-
}
|
51
|
-
end
|
52
|
-
|
53
|
-
# Attribute type mapping.
|
54
|
-
def self.swagger_types
|
55
|
-
{
|
56
|
-
:'border_color' => :'String',
|
57
|
-
:'border_width' => :'Float',
|
58
|
-
:'fill_color' => :'String',
|
59
|
-
:'x' => :'Float',
|
60
|
-
:'y' => :'Float',
|
61
|
-
:'width' => :'Float',
|
62
|
-
:'height' => :'Float'
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
|
-
# Initializes the object
|
67
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
-
def initialize(attributes = {})
|
69
|
-
return unless attributes.is_a?(Hash)
|
70
|
-
|
71
|
-
# convert string to symbol for hash key
|
72
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
73
|
-
|
74
|
-
if attributes.has_key?(:'BorderColor')
|
75
|
-
self.border_color = attributes[:'BorderColor']
|
76
|
-
end
|
77
|
-
|
78
|
-
if attributes.has_key?(:'BorderWidth')
|
79
|
-
self.border_width = attributes[:'BorderWidth']
|
80
|
-
end
|
81
|
-
|
82
|
-
if attributes.has_key?(:'FillColor')
|
83
|
-
self.fill_color = attributes[:'FillColor']
|
84
|
-
end
|
85
|
-
|
86
|
-
if attributes.has_key?(:'X')
|
87
|
-
self.x = attributes[:'X']
|
88
|
-
end
|
89
|
-
|
90
|
-
if attributes.has_key?(:'Y')
|
91
|
-
self.y = attributes[:'Y']
|
92
|
-
end
|
93
|
-
|
94
|
-
if attributes.has_key?(:'Width')
|
95
|
-
self.width = attributes[:'Width']
|
96
|
-
end
|
97
|
-
|
98
|
-
if attributes.has_key?(:'Height')
|
99
|
-
self.height = attributes[:'Height']
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
105
|
-
# @return Array for valid properties with the reasons
|
106
|
-
def list_invalid_properties
|
107
|
-
invalid_properties = Array.new
|
108
|
-
return invalid_properties
|
109
|
-
end
|
110
|
-
|
111
|
-
# Check to see if the all the properties in the model are valid
|
112
|
-
# @return true if the model is valid
|
113
|
-
def valid?
|
114
|
-
return true
|
115
|
-
end
|
116
|
-
|
117
|
-
# Checks equality by comparing each attribute.
|
118
|
-
# @param [Object] Object to be compared
|
119
|
-
def ==(o)
|
120
|
-
return true if self.equal?(o)
|
121
|
-
self.class == o.class &&
|
122
|
-
border_color == o.border_color &&
|
123
|
-
border_width == o.border_width &&
|
124
|
-
fill_color == o.fill_color &&
|
125
|
-
x == o.x &&
|
126
|
-
y == o.y &&
|
127
|
-
width == o.width &&
|
128
|
-
height == o.height
|
129
|
-
end
|
130
|
-
|
131
|
-
# @see the `==` method
|
132
|
-
# @param [Object] Object to be compared
|
133
|
-
def eql?(o)
|
134
|
-
self == o
|
135
|
-
end
|
136
|
-
|
137
|
-
# Calculates hash code according to all attributes.
|
138
|
-
# @return [Fixnum] Hash code
|
139
|
-
def hash
|
140
|
-
[border_color, border_width, fill_color, x, y, width, height].hash
|
141
|
-
end
|
142
|
-
|
143
|
-
# Builds the object from hash
|
144
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
145
|
-
# @return [Object] Returns the model itself
|
146
|
-
def build_from_hash(attributes)
|
147
|
-
return nil unless attributes.is_a?(Hash)
|
148
|
-
self.class.swagger_types.each_pair do |key, type|
|
149
|
-
if type =~ /\AArray<(.*)>/i
|
150
|
-
# check to ensure the input is an array given that the the attribute
|
151
|
-
# is documented as an array but the input is not
|
152
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
153
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
154
|
-
end
|
155
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
156
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
157
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
158
|
-
end
|
159
|
-
|
160
|
-
self
|
161
|
-
end
|
162
|
-
|
163
|
-
# Deserializes the data based on type
|
164
|
-
# @param string type Data type
|
165
|
-
# @param string value Value to be deserialized
|
166
|
-
# @return [Object] Deserialized data
|
167
|
-
def _deserialize(type, value)
|
168
|
-
case type.to_sym
|
169
|
-
when :DateTime
|
170
|
-
DateTime.parse(value)
|
171
|
-
when :Date
|
172
|
-
Date.parse(value)
|
173
|
-
when :String
|
174
|
-
value.to_s
|
175
|
-
when :Integer
|
176
|
-
value.to_i
|
177
|
-
when :Float
|
178
|
-
value.to_f
|
179
|
-
when :BOOLEAN
|
180
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
181
|
-
true
|
182
|
-
else
|
183
|
-
false
|
184
|
-
end
|
185
|
-
when :Object
|
186
|
-
# generic object (usually a Hash), return directly
|
187
|
-
value
|
188
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
189
|
-
inner_type = Regexp.last_match[:inner_type]
|
190
|
-
value.map { |v| _deserialize(inner_type, v) }
|
191
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
192
|
-
k_type = Regexp.last_match[:k_type]
|
193
|
-
v_type = Regexp.last_match[:v_type]
|
194
|
-
{}.tap do |hash|
|
195
|
-
value.each do |k, v|
|
196
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
197
|
-
end
|
198
|
-
end
|
199
|
-
else # model
|
200
|
-
temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
|
201
|
-
temp_model.build_from_hash(value)
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
# Returns the string representation of the object
|
206
|
-
# @return [String] String presentation of the object
|
207
|
-
def to_s
|
208
|
-
to_hash.to_s
|
209
|
-
end
|
210
|
-
|
211
|
-
# to_body is an alias to to_hash (backward compatibility)
|
212
|
-
# @return [Hash] Returns the object in the form of hash
|
213
|
-
def to_body
|
214
|
-
to_hash
|
215
|
-
end
|
216
|
-
|
217
|
-
# Returns the object in the form of hash
|
218
|
-
# @return [Hash] Returns the object in the form of hash
|
219
|
-
def to_hash
|
220
|
-
hash = {}
|
221
|
-
self.class.attribute_map.each_pair do |attr, param|
|
222
|
-
value = self.send(attr)
|
223
|
-
next if value.nil?
|
224
|
-
hash[param] = _to_hash(value)
|
225
|
-
end
|
226
|
-
hash
|
227
|
-
end
|
228
|
-
|
229
|
-
# Outputs non-array value in the form of hash
|
230
|
-
# For object, use to_hash. Otherwise, just return the value
|
231
|
-
# @param [Object] value Any valid value
|
232
|
-
# @return [Hash] Returns the value in the form of hash
|
233
|
-
def _to_hash(value)
|
234
|
-
if value.is_a?(Array)
|
235
|
-
value.compact.map{ |v| _to_hash(v) }
|
236
|
-
elsif value.is_a?(Hash)
|
237
|
-
{}.tap do |hash|
|
238
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
239
|
-
end
|
240
|
-
elsif value.respond_to? :to_hash
|
241
|
-
value.to_hash
|
242
|
-
else
|
243
|
-
value
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
|
-
end
|
248
|
-
|
249
|
-
end
|