cloudmersive-validate-api-client 2.0.5 → 2.1.0

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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -4
  3. data/docs/AddressApi.md +224 -4
  4. data/docs/CountryDetails.md +5 -0
  5. data/docs/DomainApi.md +55 -0
  6. data/docs/DomainQualityResponse.md +8 -0
  7. data/docs/IPAddressApi.md +55 -0
  8. data/docs/IPThreatResponse.md +9 -0
  9. data/docs/ReverseGeocodeAddressRequest.md +9 -0
  10. data/docs/ReverseGeocodeAddressResponse.md +14 -0
  11. data/docs/ValidateCountryResponse.md +5 -0
  12. data/lib/cloudmersive-validate-api-client.rb +4 -0
  13. data/lib/cloudmersive-validate-api-client/api/address_api.rb +224 -8
  14. data/lib/cloudmersive-validate-api-client/api/domain_api.rb +54 -0
  15. data/lib/cloudmersive-validate-api-client/api/ip_address_api.rb +54 -0
  16. data/lib/cloudmersive-validate-api-client/models/country_details.rb +54 -4
  17. data/lib/cloudmersive-validate-api-client/models/domain_quality_response.rb +186 -0
  18. data/lib/cloudmersive-validate-api-client/models/ip_threat_response.rb +196 -0
  19. data/lib/cloudmersive-validate-api-client/models/reverse_geocode_address_request.rb +196 -0
  20. data/lib/cloudmersive-validate-api-client/models/reverse_geocode_address_response.rb +246 -0
  21. data/lib/cloudmersive-validate-api-client/models/validate_country_response.rb +54 -4
  22. data/lib/cloudmersive-validate-api-client/version.rb +1 -1
  23. data/spec/api/address_api_spec.rb +52 -4
  24. data/spec/api/domain_api_spec.rb +12 -0
  25. data/spec/api/ip_address_api_spec.rb +12 -0
  26. data/spec/models/country_details_spec.rb +30 -0
  27. data/spec/models/domain_quality_response_spec.rb +41 -0
  28. data/spec/models/ip_threat_response_spec.rb +47 -0
  29. data/spec/models/reverse_geocode_address_request_spec.rb +47 -0
  30. data/spec/models/reverse_geocode_address_response_spec.rb +77 -0
  31. data/spec/models/validate_country_response_spec.rb +30 -0
  32. metadata +14 -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
+ # Request to reverse geocode a Street Address
17
+ class ReverseGeocodeAddressRequest
18
+ # Latitude coordinate in WGS84 format
19
+ attr_accessor :latitude
20
+
21
+ # Longitude coordinate in WGS84 format
22
+ attr_accessor :longitude
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'latitude' => :'Latitude',
28
+ :'longitude' => :'Longitude'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'latitude' => :'Float',
36
+ :'longitude' => :'Float'
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?(:'Latitude')
49
+ self.latitude = attributes[:'Latitude']
50
+ end
51
+
52
+ if attributes.has_key?(:'Longitude')
53
+ self.longitude = attributes[:'Longitude']
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
+ latitude == o.latitude &&
76
+ longitude == o.longitude
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
+ [latitude, longitude].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,246 @@
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
+ # Result of reverse geocoding a street address
17
+ class ReverseGeocodeAddressResponse
18
+ # True if the address operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Street address to validate, such as '2950 Buskirk Ave.'
22
+ attr_accessor :street_address
23
+
24
+ # City part of the addrerss to validate, such as 'Walnut Creek'
25
+ attr_accessor :city
26
+
27
+ # State or province of the address to validate, such as 'CA' or 'California'
28
+ attr_accessor :state_or_province
29
+
30
+ # Zip code or postal code of the address to validate, such as '94597'
31
+ attr_accessor :postal_code
32
+
33
+ # Name of the country, such as 'United States'. Global countries are supported.
34
+ attr_accessor :country_full_name
35
+
36
+ # Three-letter ISO 3166-1 country code
37
+ attr_accessor :country_code
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'successful' => :'Successful',
43
+ :'street_address' => :'StreetAddress',
44
+ :'city' => :'City',
45
+ :'state_or_province' => :'StateOrProvince',
46
+ :'postal_code' => :'PostalCode',
47
+ :'country_full_name' => :'CountryFullName',
48
+ :'country_code' => :'CountryCode'
49
+ }
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.swagger_types
54
+ {
55
+ :'successful' => :'BOOLEAN',
56
+ :'street_address' => :'String',
57
+ :'city' => :'String',
58
+ :'state_or_province' => :'String',
59
+ :'postal_code' => :'String',
60
+ :'country_full_name' => :'String',
61
+ :'country_code' => :'String'
62
+ }
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ return unless attributes.is_a?(Hash)
69
+
70
+ # convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
72
+
73
+ if attributes.has_key?(:'Successful')
74
+ self.successful = attributes[:'Successful']
75
+ end
76
+
77
+ if attributes.has_key?(:'StreetAddress')
78
+ self.street_address = attributes[:'StreetAddress']
79
+ end
80
+
81
+ if attributes.has_key?(:'City')
82
+ self.city = attributes[:'City']
83
+ end
84
+
85
+ if attributes.has_key?(:'StateOrProvince')
86
+ self.state_or_province = attributes[:'StateOrProvince']
87
+ end
88
+
89
+ if attributes.has_key?(:'PostalCode')
90
+ self.postal_code = attributes[:'PostalCode']
91
+ end
92
+
93
+ if attributes.has_key?(:'CountryFullName')
94
+ self.country_full_name = attributes[:'CountryFullName']
95
+ end
96
+
97
+ if attributes.has_key?(:'CountryCode')
98
+ self.country_code = attributes[:'CountryCode']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ true
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ successful == o.successful &&
121
+ street_address == o.street_address &&
122
+ city == o.city &&
123
+ state_or_province == o.state_or_province &&
124
+ postal_code == o.postal_code &&
125
+ country_full_name == o.country_full_name &&
126
+ country_code == o.country_code
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Fixnum] Hash code
137
+ def hash
138
+ [successful, street_address, city, state_or_province, postal_code, country_full_name, country_code].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ self.class.swagger_types.each_pair do |key, type|
147
+ if type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
151
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
152
+ end
153
+ elsif !attributes[self.class.attribute_map[key]].nil?
154
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
156
+ end
157
+
158
+ self
159
+ end
160
+
161
+ # Deserializes the data based on type
162
+ # @param string type Data type
163
+ # @param string value Value to be deserialized
164
+ # @return [Object] Deserialized data
165
+ def _deserialize(type, value)
166
+ case type.to_sym
167
+ when :DateTime
168
+ DateTime.parse(value)
169
+ when :Date
170
+ Date.parse(value)
171
+ when :String
172
+ value.to_s
173
+ when :Integer
174
+ value.to_i
175
+ when :Float
176
+ value.to_f
177
+ when :BOOLEAN
178
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
+ true
180
+ else
181
+ false
182
+ end
183
+ when :Object
184
+ # generic object (usually a Hash), return directly
185
+ value
186
+ when /\AArray<(?<inner_type>.+)>\z/
187
+ inner_type = Regexp.last_match[:inner_type]
188
+ value.map { |v| _deserialize(inner_type, v) }
189
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
+ k_type = Regexp.last_match[:k_type]
191
+ v_type = Regexp.last_match[:v_type]
192
+ {}.tap do |hash|
193
+ value.each do |k, v|
194
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
+ end
196
+ end
197
+ else # model
198
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
199
+ temp_model.build_from_hash(value)
200
+ end
201
+ end
202
+
203
+ # Returns the string representation of the object
204
+ # @return [String] String presentation of the object
205
+ def to_s
206
+ to_hash.to_s
207
+ end
208
+
209
+ # to_body is an alias to to_hash (backward compatibility)
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_body
212
+ to_hash
213
+ end
214
+
215
+ # Returns the object in the form of hash
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_hash
218
+ hash = {}
219
+ self.class.attribute_map.each_pair do |attr, param|
220
+ value = self.send(attr)
221
+ next if value.nil?
222
+ hash[param] = _to_hash(value)
223
+ end
224
+ hash
225
+ end
226
+
227
+ # Outputs non-array value in the form of hash
228
+ # For object, use to_hash. Otherwise, just return the value
229
+ # @param [Object] value Any valid value
230
+ # @return [Hash] Returns the value in the form of hash
231
+ def _to_hash(value)
232
+ if value.is_a?(Array)
233
+ value.compact.map { |v| _to_hash(v) }
234
+ elsif value.is_a?(Hash)
235
+ {}.tap do |hash|
236
+ value.each { |k, v| hash[k] = _to_hash(v) }
237
+ end
238
+ elsif value.respond_to? :to_hash
239
+ value.to_hash
240
+ else
241
+ value
242
+ end
243
+ end
244
+
245
+ end
246
+ end
@@ -36,6 +36,21 @@ module CloudmersiveValidateApiClient
36
36
  # Time zones (IANA/Olsen) in the country
37
37
  attr_accessor :timezones
38
38
 
39
+ # ISO 4217 currency three-letter code associated with the country
40
+ attr_accessor :iso_currency_code
41
+
42
+ # Symbol associated with the currency
43
+ attr_accessor :currency_symbol
44
+
45
+ # Full name of the currency
46
+ attr_accessor :currency_english_name
47
+
48
+ # Region (continent) in which the country is located; possible values are None, Europe, Americas, Asia, Africa, Oceania
49
+ attr_accessor :region
50
+
51
+ # 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,
52
+ attr_accessor :subregion
53
+
39
54
  # Attribute mapping from ruby-style variable name to JSON key.
40
55
  def self.attribute_map
41
56
  {
@@ -45,7 +60,12 @@ module CloudmersiveValidateApiClient
45
60
  :'fips_two_letter_code' => :'FIPSTwoLetterCode',
46
61
  :'three_letter_code' => :'ThreeLetterCode',
47
62
  :'is_european_union_member' => :'IsEuropeanUnionMember',
48
- :'timezones' => :'Timezones'
63
+ :'timezones' => :'Timezones',
64
+ :'iso_currency_code' => :'ISOCurrencyCode',
65
+ :'currency_symbol' => :'CurrencySymbol',
66
+ :'currency_english_name' => :'CurrencyEnglishName',
67
+ :'region' => :'Region',
68
+ :'subregion' => :'Subregion'
49
69
  }
50
70
  end
51
71
 
@@ -58,7 +78,12 @@ module CloudmersiveValidateApiClient
58
78
  :'fips_two_letter_code' => :'String',
59
79
  :'three_letter_code' => :'String',
60
80
  :'is_european_union_member' => :'BOOLEAN',
61
- :'timezones' => :'Array<Timezone>'
81
+ :'timezones' => :'Array<Timezone>',
82
+ :'iso_currency_code' => :'String',
83
+ :'currency_symbol' => :'String',
84
+ :'currency_english_name' => :'String',
85
+ :'region' => :'String',
86
+ :'subregion' => :'String'
62
87
  }
63
88
  end
64
89
 
@@ -99,6 +124,26 @@ module CloudmersiveValidateApiClient
99
124
  self.timezones = value
100
125
  end
101
126
  end
127
+
128
+ if attributes.has_key?(:'ISOCurrencyCode')
129
+ self.iso_currency_code = attributes[:'ISOCurrencyCode']
130
+ end
131
+
132
+ if attributes.has_key?(:'CurrencySymbol')
133
+ self.currency_symbol = attributes[:'CurrencySymbol']
134
+ end
135
+
136
+ if attributes.has_key?(:'CurrencyEnglishName')
137
+ self.currency_english_name = attributes[:'CurrencyEnglishName']
138
+ end
139
+
140
+ if attributes.has_key?(:'Region')
141
+ self.region = attributes[:'Region']
142
+ end
143
+
144
+ if attributes.has_key?(:'Subregion')
145
+ self.subregion = attributes[:'Subregion']
146
+ end
102
147
  end
103
148
 
104
149
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -125,7 +170,12 @@ module CloudmersiveValidateApiClient
125
170
  fips_two_letter_code == o.fips_two_letter_code &&
126
171
  three_letter_code == o.three_letter_code &&
127
172
  is_european_union_member == o.is_european_union_member &&
128
- timezones == o.timezones
173
+ timezones == o.timezones &&
174
+ iso_currency_code == o.iso_currency_code &&
175
+ currency_symbol == o.currency_symbol &&
176
+ currency_english_name == o.currency_english_name &&
177
+ region == o.region &&
178
+ subregion == o.subregion
129
179
  end
130
180
 
131
181
  # @see the `==` method
@@ -137,7 +187,7 @@ module CloudmersiveValidateApiClient
137
187
  # Calculates hash code according to all attributes.
138
188
  # @return [Fixnum] Hash code
139
189
  def hash
140
- [successful, country_full_name, iso_two_letter_code, fips_two_letter_code, three_letter_code, is_european_union_member, timezones].hash
190
+ [successful, country_full_name, iso_two_letter_code, fips_two_letter_code, three_letter_code, is_european_union_member, timezones, iso_currency_code, currency_symbol, currency_english_name, region, subregion].hash
141
191
  end
142
192
 
143
193
  # Builds the object from hash