cloudmersive-validate-api-client 2.1.0 → 2.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -4
  3. data/docs/AddressApi.md +55 -0
  4. data/docs/BotCheckResponse.md +8 -0
  5. data/docs/DateTimeApi.md +222 -0
  6. data/docs/DateTimeNaturalLanguageParseRequest.md +8 -0
  7. data/docs/DateTimeNowResult.md +10 -0
  8. data/docs/DateTimeStandardizedParseRequest.md +9 -0
  9. data/docs/DateTimeStandardizedParseResponse.md +16 -0
  10. data/docs/DomainApi.md +3 -3
  11. data/docs/EmailApi.md +3 -3
  12. data/docs/GeolocateStreetAddressResponse.md +13 -0
  13. data/docs/GetPublicHolidaysRequest.md +9 -0
  14. data/docs/IPAddressApi.md +223 -3
  15. data/docs/IPIntelligenceResponse.md +16 -0
  16. data/docs/IPReverseDNSLookupResponse.md +9 -0
  17. data/docs/NormalizeAddressResponse.md +18 -0
  18. data/docs/PublicHolidayOccurrence.md +12 -0
  19. data/docs/PublicHolidaysResponse.md +9 -0
  20. data/docs/TextInputApi.md +173 -0
  21. data/docs/XssProtectionBatchRequest.md +8 -0
  22. data/docs/XssProtectionBatchResponse.md +8 -0
  23. data/docs/XssProtectionRequestItem.md +8 -0
  24. data/docs/XssProtectionResult.md +11 -0
  25. data/lib/cloudmersive-validate-api-client.rb +18 -0
  26. data/lib/cloudmersive-validate-api-client/api/address_api.rb +54 -0
  27. data/lib/cloudmersive-validate-api-client/api/date_time_api.rb +231 -0
  28. data/lib/cloudmersive-validate-api-client/api/domain_api.rb +3 -3
  29. data/lib/cloudmersive-validate-api-client/api/email_api.rb +3 -3
  30. data/lib/cloudmersive-validate-api-client/api/ip_address_api.rb +219 -3
  31. data/lib/cloudmersive-validate-api-client/api/text_input_api.rb +185 -0
  32. data/lib/cloudmersive-validate-api-client/models/bot_check_response.rb +186 -0
  33. data/lib/cloudmersive-validate-api-client/models/date_time_natural_language_parse_request.rb +186 -0
  34. data/lib/cloudmersive-validate-api-client/models/date_time_now_result.rb +206 -0
  35. data/lib/cloudmersive-validate-api-client/models/date_time_standardized_parse_request.rb +196 -0
  36. data/lib/cloudmersive-validate-api-client/models/date_time_standardized_parse_response.rb +266 -0
  37. data/lib/cloudmersive-validate-api-client/models/geolocate_response.rb +1 -1
  38. data/lib/cloudmersive-validate-api-client/models/geolocate_street_address_response.rb +236 -0
  39. data/lib/cloudmersive-validate-api-client/models/get_public_holidays_request.rb +196 -0
  40. data/lib/cloudmersive-validate-api-client/models/ip_intelligence_response.rb +266 -0
  41. data/lib/cloudmersive-validate-api-client/models/ip_reverse_dns_lookup_response.rb +196 -0
  42. data/lib/cloudmersive-validate-api-client/models/normalize_address_response.rb +286 -0
  43. data/lib/cloudmersive-validate-api-client/models/public_holiday_occurrence.rb +226 -0
  44. data/lib/cloudmersive-validate-api-client/models/public_holidays_response.rb +198 -0
  45. data/lib/cloudmersive-validate-api-client/models/xss_protection_batch_request.rb +188 -0
  46. data/lib/cloudmersive-validate-api-client/models/xss_protection_batch_response.rb +188 -0
  47. data/lib/cloudmersive-validate-api-client/models/xss_protection_request_item.rb +186 -0
  48. data/lib/cloudmersive-validate-api-client/models/xss_protection_result.rb +216 -0
  49. data/lib/cloudmersive-validate-api-client/version.rb +1 -1
  50. data/spec/api/address_api_spec.rb +12 -0
  51. data/spec/api/date_time_api_spec.rb +82 -0
  52. data/spec/api/ip_address_api_spec.rb +48 -0
  53. data/spec/api/text_input_api_spec.rb +71 -0
  54. data/spec/models/bot_check_response_spec.rb +41 -0
  55. data/spec/models/date_time_natural_language_parse_request_spec.rb +41 -0
  56. data/spec/models/date_time_now_result_spec.rb +53 -0
  57. data/spec/models/date_time_standardized_parse_request_spec.rb +47 -0
  58. data/spec/models/date_time_standardized_parse_response_spec.rb +89 -0
  59. data/spec/models/geolocate_street_address_response_spec.rb +71 -0
  60. data/spec/models/get_public_holidays_request_spec.rb +47 -0
  61. data/spec/models/ip_intelligence_response_spec.rb +89 -0
  62. data/spec/models/ip_reverse_dns_lookup_response_spec.rb +47 -0
  63. data/spec/models/normalize_address_response_spec.rb +101 -0
  64. data/spec/models/public_holiday_occurrence_spec.rb +65 -0
  65. data/spec/models/public_holidays_response_spec.rb +47 -0
  66. data/spec/models/xss_protection_batch_request_spec.rb +41 -0
  67. data/spec/models/xss_protection_batch_response_spec.rb +41 -0
  68. data/spec/models/xss_protection_request_item_spec.rb +41 -0
  69. data/spec/models/xss_protection_result_spec.rb +59 -0
  70. metadata +56 -2
@@ -0,0 +1,196 @@
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: 2.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveValidateApiClient
16
+ # Input parameter to a country validation request
17
+ class GetPublicHolidaysRequest
18
+ # Two-letter code (FIPS 10-4 or ISO 3166-1) of the country; if not specified, defaults to United States
19
+ attr_accessor :raw_country_input
20
+
21
+ # Optional - the year in which to retrieve the holidays; if left blank (0) it will default to the current year
22
+ attr_accessor :year
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'raw_country_input' => :'RawCountryInput',
28
+ :'year' => :'Year'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'raw_country_input' => :'String',
36
+ :'year' => :'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?(:'RawCountryInput')
49
+ self.raw_country_input = attributes[:'RawCountryInput']
50
+ end
51
+
52
+ if attributes.has_key?(:'Year')
53
+ self.year = attributes[:'Year']
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
+ raw_country_input == o.raw_country_input &&
76
+ year == o.year
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
+ [raw_country_input, year].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 = CloudmersiveValidateApiClient.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,266 @@
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: 2.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveValidateApiClient
16
+ # IP address intelligence result
17
+ class IPIntelligenceResponse
18
+ # True if the IP address is a known bot, otherwise false
19
+ attr_accessor :is_bot
20
+
21
+ # True if the IP address is a known Tor exit node, otherwise false
22
+ attr_accessor :is_tor_node
23
+
24
+ # True if the IP address is a known threat IP, otherwise false
25
+ attr_accessor :is_threat
26
+
27
+ # True if the IP address is in the European Union, otherwise false
28
+ attr_accessor :is_eu
29
+
30
+ # Returns the location of the IP address
31
+ attr_accessor :location
32
+
33
+ # ISO 4217 currency code for the IP address location
34
+ attr_accessor :currency_code
35
+
36
+ # Name of the currency in English
37
+ attr_accessor :currency_name
38
+
39
+ # Region (continent) in which the country is located; possible values are None, Europe, Americas, Asia, Africa, Oceania
40
+ attr_accessor :region_area
41
+
42
+ # Subregion in which the country is located; possible values are None, NorthernEurope, WesternEurope, SouthernEurope, EasternEurope, CentralAmerica, NorthernAmerica, SouthAmerica, EasternAfrica, MiddleAfrica, NorthernAfrica , SouthernAfrica , WesternAfrica , CentralAsia , EasternAsia , SouthernAsia , SouthEasternAsia , WesternAsia , Southern , Middle , AustraliaandNewZealand , Melanesia , Polynesia , Micronesia , Caribbean,
43
+ attr_accessor :subregion_area
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'is_bot' => :'IsBot',
49
+ :'is_tor_node' => :'IsTorNode',
50
+ :'is_threat' => :'IsThreat',
51
+ :'is_eu' => :'IsEU',
52
+ :'location' => :'Location',
53
+ :'currency_code' => :'CurrencyCode',
54
+ :'currency_name' => :'CurrencyName',
55
+ :'region_area' => :'RegionArea',
56
+ :'subregion_area' => :'SubregionArea'
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.swagger_types
62
+ {
63
+ :'is_bot' => :'BOOLEAN',
64
+ :'is_tor_node' => :'BOOLEAN',
65
+ :'is_threat' => :'BOOLEAN',
66
+ :'is_eu' => :'BOOLEAN',
67
+ :'location' => :'GeolocateResponse',
68
+ :'currency_code' => :'String',
69
+ :'currency_name' => :'String',
70
+ :'region_area' => :'String',
71
+ :'subregion_area' => :'String'
72
+ }
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ return unless attributes.is_a?(Hash)
79
+
80
+ # convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
82
+
83
+ if attributes.has_key?(:'IsBot')
84
+ self.is_bot = attributes[:'IsBot']
85
+ end
86
+
87
+ if attributes.has_key?(:'IsTorNode')
88
+ self.is_tor_node = attributes[:'IsTorNode']
89
+ end
90
+
91
+ if attributes.has_key?(:'IsThreat')
92
+ self.is_threat = attributes[:'IsThreat']
93
+ end
94
+
95
+ if attributes.has_key?(:'IsEU')
96
+ self.is_eu = attributes[:'IsEU']
97
+ end
98
+
99
+ if attributes.has_key?(:'Location')
100
+ self.location = attributes[:'Location']
101
+ end
102
+
103
+ if attributes.has_key?(:'CurrencyCode')
104
+ self.currency_code = attributes[:'CurrencyCode']
105
+ end
106
+
107
+ if attributes.has_key?(:'CurrencyName')
108
+ self.currency_name = attributes[:'CurrencyName']
109
+ end
110
+
111
+ if attributes.has_key?(:'RegionArea')
112
+ self.region_area = attributes[:'RegionArea']
113
+ end
114
+
115
+ if attributes.has_key?(:'SubregionArea')
116
+ self.subregion_area = attributes[:'SubregionArea']
117
+ end
118
+ end
119
+
120
+ # Show invalid properties with the reasons. Usually used together with valid?
121
+ # @return Array for valid properties with the reasons
122
+ def list_invalid_properties
123
+ invalid_properties = Array.new
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ true
131
+ end
132
+
133
+ # Checks equality by comparing each attribute.
134
+ # @param [Object] Object to be compared
135
+ def ==(o)
136
+ return true if self.equal?(o)
137
+ self.class == o.class &&
138
+ is_bot == o.is_bot &&
139
+ is_tor_node == o.is_tor_node &&
140
+ is_threat == o.is_threat &&
141
+ is_eu == o.is_eu &&
142
+ location == o.location &&
143
+ currency_code == o.currency_code &&
144
+ currency_name == o.currency_name &&
145
+ region_area == o.region_area &&
146
+ subregion_area == o.subregion_area
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Fixnum] Hash code
157
+ def hash
158
+ [is_bot, is_tor_node, is_threat, is_eu, location, currency_code, currency_name, region_area, subregion_area].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ self.class.swagger_types.each_pair do |key, type|
167
+ if type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
171
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
172
+ end
173
+ elsif !attributes[self.class.attribute_map[key]].nil?
174
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
175
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
176
+ end
177
+
178
+ self
179
+ end
180
+
181
+ # Deserializes the data based on type
182
+ # @param string type Data type
183
+ # @param string value Value to be deserialized
184
+ # @return [Object] Deserialized data
185
+ def _deserialize(type, value)
186
+ case type.to_sym
187
+ when :DateTime
188
+ DateTime.parse(value)
189
+ when :Date
190
+ Date.parse(value)
191
+ when :String
192
+ value.to_s
193
+ when :Integer
194
+ value.to_i
195
+ when :Float
196
+ value.to_f
197
+ when :BOOLEAN
198
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
199
+ true
200
+ else
201
+ false
202
+ end
203
+ when :Object
204
+ # generic object (usually a Hash), return directly
205
+ value
206
+ when /\AArray<(?<inner_type>.+)>\z/
207
+ inner_type = Regexp.last_match[:inner_type]
208
+ value.map { |v| _deserialize(inner_type, v) }
209
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
210
+ k_type = Regexp.last_match[:k_type]
211
+ v_type = Regexp.last_match[:v_type]
212
+ {}.tap do |hash|
213
+ value.each do |k, v|
214
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
215
+ end
216
+ end
217
+ else # model
218
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
219
+ temp_model.build_from_hash(value)
220
+ end
221
+ end
222
+
223
+ # Returns the string representation of the object
224
+ # @return [String] String presentation of the object
225
+ def to_s
226
+ to_hash.to_s
227
+ end
228
+
229
+ # to_body is an alias to to_hash (backward compatibility)
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_body
232
+ to_hash
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = self.send(attr)
241
+ next if value.nil?
242
+ hash[param] = _to_hash(value)
243
+ end
244
+ hash
245
+ end
246
+
247
+ # Outputs non-array value in the form of hash
248
+ # For object, use to_hash. Otherwise, just return the value
249
+ # @param [Object] value Any valid value
250
+ # @return [Hash] Returns the value in the form of hash
251
+ def _to_hash(value)
252
+ if value.is_a?(Array)
253
+ value.compact.map { |v| _to_hash(v) }
254
+ elsif value.is_a?(Hash)
255
+ {}.tap do |hash|
256
+ value.each { |k, v| hash[k] = _to_hash(v) }
257
+ end
258
+ elsif value.respond_to? :to_hash
259
+ value.to_hash
260
+ else
261
+ value
262
+ end
263
+ end
264
+
265
+ end
266
+ end