cloudmersive-validate-api-client 1.3.5 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,319 @@
1
+ =begin
2
+ #validateapi
3
+
4
+ #The validation APIs help you validate data. Check if an E-mail address is real. Check if a domain is real. Check up on an IP address, and even where it is located. All this and much more is available in the validation API.
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 CloudmersiveValidateApiClient
16
+ # The result of a User-Agent validation request
17
+ class UserAgentValidateResponse
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # True if the request is a known robot, false otherwise
22
+ attr_accessor :is_bot
23
+
24
+ # Optional; name of the robot if the request was from a known robot, otherwise null
25
+ attr_accessor :bot_name
26
+
27
+ # Optional; if available, the URL to the robot
28
+ attr_accessor :bot_url
29
+
30
+ # Operating System of the User-Agent (e.g. Windows)
31
+ attr_accessor :operating_system
32
+
33
+ # The CPU platform of the User-Agent (e.g. x64)
34
+ attr_accessor :operating_system_cpu_platform
35
+
36
+ # The version of the operating system of the User-Agent (e.g. \"10\" for Windows 10)
37
+ attr_accessor :operating_system_version
38
+
39
+ # Device type of the User-Agent; possible values are \"DESKTOP\", \"SMARTPHONE\", \"TABLET\"
40
+ attr_accessor :device_type
41
+
42
+ # Brand name of the User-Agent
43
+ attr_accessor :device_brand_name
44
+
45
+ # Model name or number of the User-Agent
46
+ attr_accessor :device_model
47
+
48
+ # Name of the Browser
49
+ attr_accessor :browser_name
50
+
51
+ # Version of the Browser
52
+ attr_accessor :browser_version
53
+
54
+ # Name of the Browser Engine
55
+ attr_accessor :browser_engine_name
56
+
57
+ # Version of the Browser Engine
58
+ attr_accessor :browser_engine_version
59
+
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'successful' => :'Successful',
65
+ :'is_bot' => :'IsBot',
66
+ :'bot_name' => :'BotName',
67
+ :'bot_url' => :'BotURL',
68
+ :'operating_system' => :'OperatingSystem',
69
+ :'operating_system_cpu_platform' => :'OperatingSystemCPUPlatform',
70
+ :'operating_system_version' => :'OperatingSystemVersion',
71
+ :'device_type' => :'DeviceType',
72
+ :'device_brand_name' => :'DeviceBrandName',
73
+ :'device_model' => :'DeviceModel',
74
+ :'browser_name' => :'BrowserName',
75
+ :'browser_version' => :'BrowserVersion',
76
+ :'browser_engine_name' => :'BrowserEngineName',
77
+ :'browser_engine_version' => :'BrowserEngineVersion'
78
+ }
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.swagger_types
83
+ {
84
+ :'successful' => :'BOOLEAN',
85
+ :'is_bot' => :'BOOLEAN',
86
+ :'bot_name' => :'String',
87
+ :'bot_url' => :'String',
88
+ :'operating_system' => :'String',
89
+ :'operating_system_cpu_platform' => :'String',
90
+ :'operating_system_version' => :'String',
91
+ :'device_type' => :'String',
92
+ :'device_brand_name' => :'String',
93
+ :'device_model' => :'String',
94
+ :'browser_name' => :'String',
95
+ :'browser_version' => :'String',
96
+ :'browser_engine_name' => :'String',
97
+ :'browser_engine_version' => :'String'
98
+ }
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ return unless attributes.is_a?(Hash)
105
+
106
+ # convert string to symbol for hash key
107
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
108
+
109
+ if attributes.has_key?(:'Successful')
110
+ self.successful = attributes[:'Successful']
111
+ end
112
+
113
+ if attributes.has_key?(:'IsBot')
114
+ self.is_bot = attributes[:'IsBot']
115
+ end
116
+
117
+ if attributes.has_key?(:'BotName')
118
+ self.bot_name = attributes[:'BotName']
119
+ end
120
+
121
+ if attributes.has_key?(:'BotURL')
122
+ self.bot_url = attributes[:'BotURL']
123
+ end
124
+
125
+ if attributes.has_key?(:'OperatingSystem')
126
+ self.operating_system = attributes[:'OperatingSystem']
127
+ end
128
+
129
+ if attributes.has_key?(:'OperatingSystemCPUPlatform')
130
+ self.operating_system_cpu_platform = attributes[:'OperatingSystemCPUPlatform']
131
+ end
132
+
133
+ if attributes.has_key?(:'OperatingSystemVersion')
134
+ self.operating_system_version = attributes[:'OperatingSystemVersion']
135
+ end
136
+
137
+ if attributes.has_key?(:'DeviceType')
138
+ self.device_type = attributes[:'DeviceType']
139
+ end
140
+
141
+ if attributes.has_key?(:'DeviceBrandName')
142
+ self.device_brand_name = attributes[:'DeviceBrandName']
143
+ end
144
+
145
+ if attributes.has_key?(:'DeviceModel')
146
+ self.device_model = attributes[:'DeviceModel']
147
+ end
148
+
149
+ if attributes.has_key?(:'BrowserName')
150
+ self.browser_name = attributes[:'BrowserName']
151
+ end
152
+
153
+ if attributes.has_key?(:'BrowserVersion')
154
+ self.browser_version = attributes[:'BrowserVersion']
155
+ end
156
+
157
+ if attributes.has_key?(:'BrowserEngineName')
158
+ self.browser_engine_name = attributes[:'BrowserEngineName']
159
+ end
160
+
161
+ if attributes.has_key?(:'BrowserEngineVersion')
162
+ self.browser_engine_version = attributes[:'BrowserEngineVersion']
163
+ end
164
+
165
+ end
166
+
167
+ # Show invalid properties with the reasons. Usually used together with valid?
168
+ # @return Array for valid properties with the reasons
169
+ def list_invalid_properties
170
+ invalid_properties = Array.new
171
+ return invalid_properties
172
+ end
173
+
174
+ # Check to see if the all the properties in the model are valid
175
+ # @return true if the model is valid
176
+ def valid?
177
+ return true
178
+ end
179
+
180
+ # Checks equality by comparing each attribute.
181
+ # @param [Object] Object to be compared
182
+ def ==(o)
183
+ return true if self.equal?(o)
184
+ self.class == o.class &&
185
+ successful == o.successful &&
186
+ is_bot == o.is_bot &&
187
+ bot_name == o.bot_name &&
188
+ bot_url == o.bot_url &&
189
+ operating_system == o.operating_system &&
190
+ operating_system_cpu_platform == o.operating_system_cpu_platform &&
191
+ operating_system_version == o.operating_system_version &&
192
+ device_type == o.device_type &&
193
+ device_brand_name == o.device_brand_name &&
194
+ device_model == o.device_model &&
195
+ browser_name == o.browser_name &&
196
+ browser_version == o.browser_version &&
197
+ browser_engine_name == o.browser_engine_name &&
198
+ browser_engine_version == o.browser_engine_version
199
+ end
200
+
201
+ # @see the `==` method
202
+ # @param [Object] Object to be compared
203
+ def eql?(o)
204
+ self == o
205
+ end
206
+
207
+ # Calculates hash code according to all attributes.
208
+ # @return [Fixnum] Hash code
209
+ def hash
210
+ [successful, is_bot, bot_name, bot_url, operating_system, operating_system_cpu_platform, operating_system_version, device_type, device_brand_name, device_model, browser_name, browser_version, browser_engine_name, browser_engine_version].hash
211
+ end
212
+
213
+ # Builds the object from hash
214
+ # @param [Hash] attributes Model attributes in the form of hash
215
+ # @return [Object] Returns the model itself
216
+ def build_from_hash(attributes)
217
+ return nil unless attributes.is_a?(Hash)
218
+ self.class.swagger_types.each_pair do |key, type|
219
+ if type =~ /\AArray<(.*)>/i
220
+ # check to ensure the input is an array given that the the attribute
221
+ # is documented as an array but the input is not
222
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
223
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
224
+ end
225
+ elsif !attributes[self.class.attribute_map[key]].nil?
226
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
227
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
228
+ end
229
+
230
+ self
231
+ end
232
+
233
+ # Deserializes the data based on type
234
+ # @param string type Data type
235
+ # @param string value Value to be deserialized
236
+ # @return [Object] Deserialized data
237
+ def _deserialize(type, value)
238
+ case type.to_sym
239
+ when :DateTime
240
+ DateTime.parse(value)
241
+ when :Date
242
+ Date.parse(value)
243
+ when :String
244
+ value.to_s
245
+ when :Integer
246
+ value.to_i
247
+ when :Float
248
+ value.to_f
249
+ when :BOOLEAN
250
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
251
+ true
252
+ else
253
+ false
254
+ end
255
+ when :Object
256
+ # generic object (usually a Hash), return directly
257
+ value
258
+ when /\AArray<(?<inner_type>.+)>\z/
259
+ inner_type = Regexp.last_match[:inner_type]
260
+ value.map { |v| _deserialize(inner_type, v) }
261
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
262
+ k_type = Regexp.last_match[:k_type]
263
+ v_type = Regexp.last_match[:v_type]
264
+ {}.tap do |hash|
265
+ value.each do |k, v|
266
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
267
+ end
268
+ end
269
+ else # model
270
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
271
+ temp_model.build_from_hash(value)
272
+ end
273
+ end
274
+
275
+ # Returns the string representation of the object
276
+ # @return [String] String presentation of the object
277
+ def to_s
278
+ to_hash.to_s
279
+ end
280
+
281
+ # to_body is an alias to to_hash (backward compatibility)
282
+ # @return [Hash] Returns the object in the form of hash
283
+ def to_body
284
+ to_hash
285
+ end
286
+
287
+ # Returns the object in the form of hash
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_hash
290
+ hash = {}
291
+ self.class.attribute_map.each_pair do |attr, param|
292
+ value = self.send(attr)
293
+ next if value.nil?
294
+ hash[param] = _to_hash(value)
295
+ end
296
+ hash
297
+ end
298
+
299
+ # Outputs non-array value in the form of hash
300
+ # For object, use to_hash. Otherwise, just return the value
301
+ # @param [Object] value Any valid value
302
+ # @return [Hash] Returns the value in the form of hash
303
+ def _to_hash(value)
304
+ if value.is_a?(Array)
305
+ value.compact.map{ |v| _to_hash(v) }
306
+ elsif value.is_a?(Hash)
307
+ {}.tap do |hash|
308
+ value.each { |k, v| hash[k] = _to_hash(v) }
309
+ end
310
+ elsif value.respond_to? :to_hash
311
+ value.to_hash
312
+ else
313
+ value
314
+ end
315
+ end
316
+
317
+ end
318
+
319
+ end
@@ -0,0 +1,188 @@
1
+ =begin
2
+ #validateapi
3
+
4
+ #The validation APIs help you validate data. Check if an E-mail address is real. Check if a domain is real. Check up on an IP address, and even where it is located. All this and much more is available in the validation API.
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 CloudmersiveValidateApiClient
16
+ # Request to determine if a URL is valid
17
+ class ValidateUrlRequestFull
18
+ attr_accessor :url
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'url' => :'URL'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'url' => :'String'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
+
43
+ if attributes.has_key?(:'URL')
44
+ self.url = attributes[:'URL']
45
+ end
46
+
47
+ end
48
+
49
+ # Show invalid properties with the reasons. Usually used together with valid?
50
+ # @return Array for valid properties with the reasons
51
+ def list_invalid_properties
52
+ invalid_properties = Array.new
53
+ return invalid_properties
54
+ end
55
+
56
+ # Check to see if the all the properties in the model are valid
57
+ # @return true if the model is valid
58
+ def valid?
59
+ return true
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] Object to be compared
64
+ def ==(o)
65
+ return true if self.equal?(o)
66
+ self.class == o.class &&
67
+ url == o.url
68
+ end
69
+
70
+ # @see the `==` method
71
+ # @param [Object] Object to be compared
72
+ def eql?(o)
73
+ self == o
74
+ end
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Fixnum] Hash code
78
+ def hash
79
+ [url].hash
80
+ end
81
+
82
+ # Builds the object from hash
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ # @return [Object] Returns the model itself
85
+ def build_from_hash(attributes)
86
+ return nil unless attributes.is_a?(Hash)
87
+ self.class.swagger_types.each_pair do |key, type|
88
+ if type =~ /\AArray<(.*)>/i
89
+ # check to ensure the input is an array given that the the attribute
90
+ # is documented as an array but the input is not
91
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
92
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
93
+ end
94
+ elsif !attributes[self.class.attribute_map[key]].nil?
95
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
96
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
97
+ end
98
+
99
+ self
100
+ end
101
+
102
+ # Deserializes the data based on type
103
+ # @param string type Data type
104
+ # @param string value Value to be deserialized
105
+ # @return [Object] Deserialized data
106
+ def _deserialize(type, value)
107
+ case type.to_sym
108
+ when :DateTime
109
+ DateTime.parse(value)
110
+ when :Date
111
+ Date.parse(value)
112
+ when :String
113
+ value.to_s
114
+ when :Integer
115
+ value.to_i
116
+ when :Float
117
+ value.to_f
118
+ when :BOOLEAN
119
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
+ true
121
+ else
122
+ false
123
+ end
124
+ when :Object
125
+ # generic object (usually a Hash), return directly
126
+ value
127
+ when /\AArray<(?<inner_type>.+)>\z/
128
+ inner_type = Regexp.last_match[:inner_type]
129
+ value.map { |v| _deserialize(inner_type, v) }
130
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
+ k_type = Regexp.last_match[:k_type]
132
+ v_type = Regexp.last_match[:v_type]
133
+ {}.tap do |hash|
134
+ value.each do |k, v|
135
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
+ end
137
+ end
138
+ else # model
139
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
140
+ temp_model.build_from_hash(value)
141
+ end
142
+ end
143
+
144
+ # Returns the string representation of the object
145
+ # @return [String] String presentation of the object
146
+ def to_s
147
+ to_hash.to_s
148
+ end
149
+
150
+ # to_body is an alias to to_hash (backward compatibility)
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_body
153
+ to_hash
154
+ end
155
+
156
+ # Returns the object in the form of hash
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_hash
159
+ hash = {}
160
+ self.class.attribute_map.each_pair do |attr, param|
161
+ value = self.send(attr)
162
+ next if value.nil?
163
+ hash[param] = _to_hash(value)
164
+ end
165
+ hash
166
+ end
167
+
168
+ # Outputs non-array value in the form of hash
169
+ # For object, use to_hash. Otherwise, just return the value
170
+ # @param [Object] value Any valid value
171
+ # @return [Hash] Returns the value in the form of hash
172
+ def _to_hash(value)
173
+ if value.is_a?(Array)
174
+ value.compact.map{ |v| _to_hash(v) }
175
+ elsif value.is_a?(Hash)
176
+ {}.tap do |hash|
177
+ value.each { |k, v| hash[k] = _to_hash(v) }
178
+ end
179
+ elsif value.respond_to? :to_hash
180
+ value.to_hash
181
+ else
182
+ value
183
+ end
184
+ end
185
+
186
+ end
187
+
188
+ end