cloudmersive-image-recognition-api-client 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +132 -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/DetectedLicensePlate.md +14 -0
  9. data/docs/DetectedObject.md +13 -0
  10. data/docs/DrawRectangleInstance.md +14 -0
  11. data/docs/DrawRectangleRequest.md +10 -0
  12. data/docs/DrawTextInstance.md +15 -0
  13. data/docs/DrawTextRequest.md +10 -0
  14. data/docs/EditApi.md +179 -0
  15. data/docs/Face.md +11 -0
  16. data/docs/FaceApi.md +228 -0
  17. data/docs/FaceLocateResponse.md +11 -0
  18. data/docs/ImageDescriptionResponse.md +11 -0
  19. data/docs/NsfwApi.md +63 -0
  20. data/docs/NsfwResult.md +10 -0
  21. data/docs/ObjectDetectionResult.md +10 -0
  22. data/docs/PersonWithAge.md +10 -0
  23. data/docs/RecognitionOutcome.md +9 -0
  24. data/docs/RecognizeApi.md +287 -0
  25. data/docs/ResizeApi.md +69 -0
  26. data/docs/VehicleLicensePlateDetectionResult.md +10 -0
  27. data/git_push.sh +55 -0
  28. data/lib/cloudmersive-image-recognition-api-client.rb +60 -0
  29. data/lib/cloudmersive-image-recognition-api-client/api/artistic_api.rb +85 -0
  30. data/lib/cloudmersive-image-recognition-api-client/api/edit_api.rb +202 -0
  31. data/lib/cloudmersive-image-recognition-api-client/api/face_api.rb +247 -0
  32. data/lib/cloudmersive-image-recognition-api-client/api/nsfw_api.rb +79 -0
  33. data/lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb +306 -0
  34. data/lib/cloudmersive-image-recognition-api-client/api/resize_api.rb +91 -0
  35. data/lib/cloudmersive-image-recognition-api-client/api_client.rb +389 -0
  36. data/lib/cloudmersive-image-recognition-api-client/api_error.rb +38 -0
  37. data/lib/cloudmersive-image-recognition-api-client/configuration.rb +209 -0
  38. data/lib/cloudmersive-image-recognition-api-client/models/age_detection_result.rb +211 -0
  39. data/lib/cloudmersive-image-recognition-api-client/models/detected_license_plate.rb +245 -0
  40. data/lib/cloudmersive-image-recognition-api-client/models/detected_object.rb +239 -0
  41. data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_instance.rb +249 -0
  42. data/lib/cloudmersive-image-recognition-api-client/models/draw_rectangle_request.rb +227 -0
  43. data/lib/cloudmersive-image-recognition-api-client/models/draw_text_instance.rb +259 -0
  44. data/lib/cloudmersive-image-recognition-api-client/models/draw_text_request.rb +227 -0
  45. data/lib/cloudmersive-image-recognition-api-client/models/face.rb +219 -0
  46. data/lib/cloudmersive-image-recognition-api-client/models/face_locate_response.rb +220 -0
  47. data/lib/cloudmersive-image-recognition-api-client/models/image_description_response.rb +219 -0
  48. data/lib/cloudmersive-image-recognition-api-client/models/nsfw_result.rb +209 -0
  49. data/lib/cloudmersive-image-recognition-api-client/models/object_detection_result.rb +211 -0
  50. data/lib/cloudmersive-image-recognition-api-client/models/person_with_age.rb +209 -0
  51. data/lib/cloudmersive-image-recognition-api-client/models/recognition_outcome.rb +199 -0
  52. data/lib/cloudmersive-image-recognition-api-client/models/vehicle_license_plate_detection_result.rb +211 -0
  53. data/lib/cloudmersive-image-recognition-api-client/version.rb +15 -0
  54. data/spec/api/artistic_api_spec.rb +48 -0
  55. data/spec/api/edit_api_spec.rb +73 -0
  56. data/spec/api/face_api_spec.rb +83 -0
  57. data/spec/api/nsfw_api_spec.rb +47 -0
  58. data/spec/api/recognize_api_spec.rb +96 -0
  59. data/spec/api/resize_api_spec.rb +49 -0
  60. data/spec/api_client_spec.rb +226 -0
  61. data/spec/configuration_spec.rb +42 -0
  62. data/spec/models/age_detection_result_spec.rb +54 -0
  63. data/spec/models/detected_license_plate_spec.rb +78 -0
  64. data/spec/models/detected_object_spec.rb +72 -0
  65. data/spec/models/draw_rectangle_instance_spec.rb +78 -0
  66. data/spec/models/draw_rectangle_request_spec.rb +54 -0
  67. data/spec/models/draw_text_instance_spec.rb +84 -0
  68. data/spec/models/draw_text_request_spec.rb +54 -0
  69. data/spec/models/face_locate_response_spec.rb +60 -0
  70. data/spec/models/face_spec.rb +60 -0
  71. data/spec/models/image_description_response_spec.rb +60 -0
  72. data/spec/models/nsfw_result_spec.rb +54 -0
  73. data/spec/models/object_detection_result_spec.rb +54 -0
  74. data/spec/models/person_with_age_spec.rb +54 -0
  75. data/spec/models/recognition_outcome_spec.rb +48 -0
  76. data/spec/models/vehicle_license_plate_detection_result_spec.rb +54 -0
  77. data/spec/spec_helper.rb +111 -0
  78. metadata +302 -0
@@ -0,0 +1,199 @@
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: unset
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveImageRecognitionApiClient
16
+ # Specific recognition outcome
17
+ class RecognitionOutcome
18
+ # Scores closer to 1 are better than scores closer to 0
19
+ attr_accessor :confidence_score
20
+
21
+ # English language description of the image
22
+ attr_accessor :description
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'confidence_score' => :'ConfidenceScore',
29
+ :'description' => :'Description'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'confidence_score' => :'Float',
37
+ :'description' => :'String'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
+
49
+ if attributes.has_key?(:'ConfidenceScore')
50
+ self.confidence_score = attributes[:'ConfidenceScore']
51
+ end
52
+
53
+ if attributes.has_key?(:'Description')
54
+ self.description = attributes[:'Description']
55
+ end
56
+
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ return invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ return true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ confidence_score == o.confidence_score &&
78
+ description == o.description
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(o)
84
+ self == o
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Fixnum] Hash code
89
+ def hash
90
+ [confidence_score, description].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def build_from_hash(attributes)
97
+ return nil unless attributes.is_a?(Hash)
98
+ self.class.swagger_types.each_pair do |key, type|
99
+ if type =~ /\AArray<(.*)>/i
100
+ # check to ensure the input is an array given that the the attribute
101
+ # is documented as an array but the input is not
102
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
103
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
104
+ end
105
+ elsif !attributes[self.class.attribute_map[key]].nil?
106
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
107
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
108
+ end
109
+
110
+ self
111
+ end
112
+
113
+ # Deserializes the data based on type
114
+ # @param string type Data type
115
+ # @param string value Value to be deserialized
116
+ # @return [Object] Deserialized data
117
+ def _deserialize(type, value)
118
+ case type.to_sym
119
+ when :DateTime
120
+ DateTime.parse(value)
121
+ when :Date
122
+ Date.parse(value)
123
+ when :String
124
+ value.to_s
125
+ when :Integer
126
+ value.to_i
127
+ when :Float
128
+ value.to_f
129
+ when :BOOLEAN
130
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
131
+ true
132
+ else
133
+ false
134
+ end
135
+ when :Object
136
+ # generic object (usually a Hash), return directly
137
+ value
138
+ when /\AArray<(?<inner_type>.+)>\z/
139
+ inner_type = Regexp.last_match[:inner_type]
140
+ value.map { |v| _deserialize(inner_type, v) }
141
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
142
+ k_type = Regexp.last_match[:k_type]
143
+ v_type = Regexp.last_match[:v_type]
144
+ {}.tap do |hash|
145
+ value.each do |k, v|
146
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
147
+ end
148
+ end
149
+ else # model
150
+ temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
151
+ temp_model.build_from_hash(value)
152
+ end
153
+ end
154
+
155
+ # Returns the string representation of the object
156
+ # @return [String] String presentation of the object
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # to_body is an alias to to_hash (backward compatibility)
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_body
164
+ to_hash
165
+ end
166
+
167
+ # Returns the object in the form of hash
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_hash
170
+ hash = {}
171
+ self.class.attribute_map.each_pair do |attr, param|
172
+ value = self.send(attr)
173
+ next if value.nil?
174
+ hash[param] = _to_hash(value)
175
+ end
176
+ hash
177
+ end
178
+
179
+ # Outputs non-array value in the form of hash
180
+ # For object, use to_hash. Otherwise, just return the value
181
+ # @param [Object] value Any valid value
182
+ # @return [Hash] Returns the value in the form of hash
183
+ def _to_hash(value)
184
+ if value.is_a?(Array)
185
+ value.compact.map{ |v| _to_hash(v) }
186
+ elsif value.is_a?(Hash)
187
+ {}.tap do |hash|
188
+ value.each { |k, v| hash[k] = _to_hash(v) }
189
+ end
190
+ elsif value.respond_to? :to_hash
191
+ value.to_hash
192
+ else
193
+ value
194
+ end
195
+ end
196
+
197
+ end
198
+
199
+ end
@@ -0,0 +1,211 @@
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: unset
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveImageRecognitionApiClient
16
+ # Result of detecting vehicle license plates in an image
17
+ class VehicleLicensePlateDetectionResult
18
+ # Was the image processed successfully?
19
+ attr_accessor :successful
20
+
21
+ # License plates found in the image
22
+ attr_accessor :detected_license_plates
23
+
24
+ # The number of license plates detected in the image
25
+ attr_accessor :detected_license_plate_count
26
+
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'successful' => :'Successful',
32
+ :'detected_license_plates' => :'DetectedLicensePlates',
33
+ :'detected_license_plate_count' => :'DetectedLicensePlateCount'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ :'successful' => :'BOOLEAN',
41
+ :'detected_license_plates' => :'Array<DetectedLicensePlate>',
42
+ :'detected_license_plate_count' => :'Integer'
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?(:'Successful')
55
+ self.successful = attributes[:'Successful']
56
+ end
57
+
58
+ if attributes.has_key?(:'DetectedLicensePlates')
59
+ if (value = attributes[:'DetectedLicensePlates']).is_a?(Array)
60
+ self.detected_license_plates = value
61
+ end
62
+ end
63
+
64
+ if attributes.has_key?(:'DetectedLicensePlateCount')
65
+ self.detected_license_plate_count = attributes[:'DetectedLicensePlateCount']
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
+ return invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ return true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ successful == o.successful &&
89
+ detected_license_plates == o.detected_license_plates &&
90
+ detected_license_plate_count == o.detected_license_plate_count
91
+ end
92
+
93
+ # @see the `==` method
94
+ # @param [Object] Object to be compared
95
+ def eql?(o)
96
+ self == o
97
+ end
98
+
99
+ # Calculates hash code according to all attributes.
100
+ # @return [Fixnum] Hash code
101
+ def hash
102
+ [successful, detected_license_plates, detected_license_plate_count].hash
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.swagger_types.each_pair do |key, type|
111
+ if type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
115
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
116
+ end
117
+ elsif !attributes[self.class.attribute_map[key]].nil?
118
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
120
+ end
121
+
122
+ self
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :BOOLEAN
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
163
+ temp_model.build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ next if value.nil?
186
+ hash[param] = _to_hash(value)
187
+ end
188
+ hash
189
+ end
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map{ |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to? :to_hash
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+
209
+ end
210
+
211
+ end
@@ -0,0 +1,15 @@
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: unset
10
+
11
+ =end
12
+
13
+ module CloudmersiveImageRecognitionApiClient
14
+ VERSION = "1.2.9"
15
+ end
@@ -0,0 +1,48 @@
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: unset
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for CloudmersiveImageRecognitionApiClient::ArtisticApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'ArtisticApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = CloudmersiveImageRecognitionApiClient::ArtisticApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of ArtisticApi' do
30
+ it 'should create an instance of ArtisticApi' do
31
+ expect(@instance).to be_instance_of(CloudmersiveImageRecognitionApiClient::ArtisticApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for artistic_painting
36
+ # Transform an image into an artistic painting automatically
37
+ # Uses machine learning to automatically transform an image into an artistic painting. Due to depth of AI processing, depending on image size this operation can take up to 20 seconds.
38
+ # @param style The style of the painting to apply. To start, try \&quot;udnie\&quot; a painting style. Possible values are: \&quot;udnie\&quot;, \&quot;wave\&quot;, \&quot;la_muse\&quot;, \&quot;rain_princess\&quot;.
39
+ # @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
40
+ # @param [Hash] opts the optional parameters
41
+ # @return [String]
42
+ describe 'artistic_painting test' do
43
+ it "should work" do
44
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
45
+ end
46
+ end
47
+
48
+ end