cloudmersive-validate-api-client 2.0.2 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/README.md +176 -0
- data/Rakefile +8 -0
- data/cloudmersive-validate-api-client.gemspec +45 -0
- data/docs/AddressApi.md +552 -0
- data/docs/AddressGetServersResponse.md +9 -0
- data/docs/AddressVerifySyntaxOnlyResponse.md +11 -0
- data/docs/CheckResponse.md +8 -0
- data/docs/CountryDetails.md +14 -0
- data/docs/CountryListResult.md +9 -0
- data/docs/DomainApi.md +228 -0
- data/docs/EmailApi.md +173 -0
- data/docs/FirstNameValidationRequest.md +8 -0
- data/docs/FirstNameValidationResponse.md +9 -0
- data/docs/FullEmailValidationResponse.md +16 -0
- data/docs/FullNameValidationRequest.md +8 -0
- data/docs/FullNameValidationResponse.md +17 -0
- data/docs/GeolocateResponse.md +16 -0
- data/docs/GetGenderRequest.md +9 -0
- data/docs/GetGenderResponse.md +9 -0
- data/docs/GetTimezonesRequest.md +8 -0
- data/docs/GetTimezonesResponse.md +13 -0
- data/docs/IPAddressApi.md +173 -0
- data/docs/IPThreatResponse.md +9 -0
- data/docs/LastNameValidationRequest.md +8 -0
- data/docs/LastNameValidationResponse.md +9 -0
- data/docs/LeadEnrichmentApi.md +61 -0
- data/docs/LeadEnrichmentRequest.md +21 -0
- data/docs/LeadEnrichmentResponse.md +25 -0
- data/docs/NameApi.md +283 -0
- data/docs/ParseAddressRequest.md +9 -0
- data/docs/ParseAddressResponse.md +16 -0
- data/docs/PhoneNumberApi.md +63 -0
- data/docs/PhoneNumberValidateRequest.md +9 -0
- data/docs/PhoneNumberValidationResponse.md +15 -0
- data/docs/Timezone.md +10 -0
- data/docs/TorNodeResponse.md +8 -0
- data/docs/UserAgentApi.md +63 -0
- data/docs/UserAgentValidateRequest.md +8 -0
- data/docs/UserAgentValidateResponse.md +21 -0
- data/docs/ValidateAddressRequest.md +13 -0
- data/docs/ValidateAddressResponse.md +10 -0
- data/docs/ValidateCityRequest.md +11 -0
- data/docs/ValidateCityResponse.md +12 -0
- data/docs/ValidateCountryRequest.md +8 -0
- data/docs/ValidateCountryResponse.md +17 -0
- data/docs/ValidateIdentifierRequest.md +15 -0
- data/docs/ValidateIdentifierResponse.md +9 -0
- data/docs/ValidatePostalCodeRequest.md +10 -0
- data/docs/ValidatePostalCodeResponse.md +12 -0
- data/docs/ValidateStateRequest.md +10 -0
- data/docs/ValidateStateResponse.md +11 -0
- data/docs/ValidateUrlRequestFull.md +8 -0
- data/docs/ValidateUrlRequestSyntaxOnly.md +8 -0
- data/docs/ValidateUrlResponseFull.md +12 -0
- data/docs/ValidateUrlResponseSyntaxOnly.md +9 -0
- data/docs/VatApi.md +63 -0
- data/docs/VatLookupRequest.md +8 -0
- data/docs/VatLookupResponse.md +19 -0
- data/docs/WhoisResponse.md +22 -0
- data/git_push.sh +55 -0
- data/lib/cloudmersive-validate-api-client.rb +95 -0
- data/lib/cloudmersive-validate-api-client/api/address_api.rb +555 -0
- data/lib/cloudmersive-validate-api-client/api/domain_api.rb +239 -0
- data/lib/cloudmersive-validate-api-client/api/email_api.rb +185 -0
- data/lib/cloudmersive-validate-api-client/api/ip_address_api.rb +185 -0
- data/lib/cloudmersive-validate-api-client/api/lead_enrichment_api.rb +75 -0
- data/lib/cloudmersive-validate-api-client/api/name_api.rb +293 -0
- data/lib/cloudmersive-validate-api-client/api/phone_number_api.rb +77 -0
- data/lib/cloudmersive-validate-api-client/api/user_agent_api.rb +77 -0
- data/lib/cloudmersive-validate-api-client/api/vat_api.rb +77 -0
- data/lib/cloudmersive-validate-api-client/api_client.rb +391 -0
- data/lib/cloudmersive-validate-api-client/api_error.rb +38 -0
- data/lib/cloudmersive-validate-api-client/configuration.rb +209 -0
- data/lib/cloudmersive-validate-api-client/models/address_get_servers_response.rb +198 -0
- data/lib/cloudmersive-validate-api-client/models/address_verify_syntax_only_response.rb +216 -0
- data/lib/cloudmersive-validate-api-client/models/check_response.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/country_details.rb +246 -0
- data/lib/cloudmersive-validate-api-client/models/country_list_result.rb +198 -0
- data/lib/cloudmersive-validate-api-client/models/first_name_validation_request.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/first_name_validation_response.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/full_email_validation_response.rb +266 -0
- data/lib/cloudmersive-validate-api-client/models/full_name_validation_request.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/full_name_validation_response.rb +276 -0
- data/lib/cloudmersive-validate-api-client/models/geolocate_response.rb +266 -0
- data/lib/cloudmersive-validate-api-client/models/get_gender_request.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/get_gender_response.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/get_timezones_request.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/get_timezones_response.rb +238 -0
- data/lib/cloudmersive-validate-api-client/models/ip_threat_response.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/last_name_validation_request.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/last_name_validation_response.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/lead_enrichment_request.rb +316 -0
- data/lib/cloudmersive-validate-api-client/models/lead_enrichment_response.rb +356 -0
- data/lib/cloudmersive-validate-api-client/models/parse_address_request.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/parse_address_response.rb +266 -0
- data/lib/cloudmersive-validate-api-client/models/phone_number_validate_request.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/phone_number_validation_response.rb +256 -0
- data/lib/cloudmersive-validate-api-client/models/timezone.rb +206 -0
- data/lib/cloudmersive-validate-api-client/models/tor_node_response.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/user_agent_validate_request.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/user_agent_validate_response.rb +316 -0
- data/lib/cloudmersive-validate-api-client/models/validate_address_request.rb +236 -0
- data/lib/cloudmersive-validate-api-client/models/validate_address_response.rb +206 -0
- data/lib/cloudmersive-validate-api-client/models/validate_city_request.rb +216 -0
- data/lib/cloudmersive-validate-api-client/models/validate_city_response.rb +226 -0
- data/lib/cloudmersive-validate-api-client/models/validate_country_request.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/validate_country_response.rb +278 -0
- data/lib/cloudmersive-validate-api-client/models/validate_identifier_request.rb +256 -0
- data/lib/cloudmersive-validate-api-client/models/validate_identifier_response.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/validate_postal_code_request.rb +206 -0
- data/lib/cloudmersive-validate-api-client/models/validate_postal_code_response.rb +226 -0
- data/lib/cloudmersive-validate-api-client/models/validate_state_request.rb +206 -0
- data/lib/cloudmersive-validate-api-client/models/validate_state_response.rb +216 -0
- data/lib/cloudmersive-validate-api-client/models/validate_url_request_full.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/validate_url_request_syntax_only.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/validate_url_response_full.rb +226 -0
- data/lib/cloudmersive-validate-api-client/models/validate_url_response_syntax_only.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/vat_lookup_request.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/vat_lookup_response.rb +295 -0
- data/lib/cloudmersive-validate-api-client/models/whois_response.rb +326 -0
- data/lib/cloudmersive-validate-api-client/version.rb +15 -0
- data/spec/api/address_api_spec.rb +154 -0
- data/spec/api/domain_api_spec.rb +83 -0
- data/spec/api/email_api_spec.rb +71 -0
- data/spec/api/ip_address_api_spec.rb +71 -0
- data/spec/api/lead_enrichment_api_spec.rb +46 -0
- data/spec/api/name_api_spec.rb +95 -0
- data/spec/api/phone_number_api_spec.rb +47 -0
- data/spec/api/user_agent_api_spec.rb +47 -0
- data/spec/api/vat_api_spec.rb +47 -0
- data/spec/api_client_spec.rb +243 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/address_get_servers_response_spec.rb +47 -0
- data/spec/models/address_verify_syntax_only_response_spec.rb +59 -0
- data/spec/models/check_response_spec.rb +41 -0
- data/spec/models/country_details_spec.rb +77 -0
- data/spec/models/country_list_result_spec.rb +47 -0
- data/spec/models/first_name_validation_request_spec.rb +41 -0
- data/spec/models/first_name_validation_response_spec.rb +47 -0
- data/spec/models/full_email_validation_response_spec.rb +89 -0
- data/spec/models/full_name_validation_request_spec.rb +41 -0
- data/spec/models/full_name_validation_response_spec.rb +95 -0
- data/spec/models/geolocate_response_spec.rb +89 -0
- data/spec/models/get_gender_request_spec.rb +47 -0
- data/spec/models/get_gender_response_spec.rb +47 -0
- data/spec/models/get_timezones_request_spec.rb +41 -0
- data/spec/models/get_timezones_response_spec.rb +71 -0
- data/spec/models/ip_threat_response_spec.rb +47 -0
- data/spec/models/last_name_validation_request_spec.rb +41 -0
- data/spec/models/last_name_validation_response_spec.rb +47 -0
- data/spec/models/lead_enrichment_request_spec.rb +119 -0
- data/spec/models/lead_enrichment_response_spec.rb +143 -0
- data/spec/models/parse_address_request_spec.rb +47 -0
- data/spec/models/parse_address_response_spec.rb +89 -0
- data/spec/models/phone_number_validate_request_spec.rb +47 -0
- data/spec/models/phone_number_validation_response_spec.rb +83 -0
- data/spec/models/timezone_spec.rb +53 -0
- data/spec/models/tor_node_response_spec.rb +41 -0
- data/spec/models/user_agent_validate_request_spec.rb +41 -0
- data/spec/models/user_agent_validate_response_spec.rb +119 -0
- data/spec/models/validate_address_request_spec.rb +71 -0
- data/spec/models/validate_address_response_spec.rb +53 -0
- data/spec/models/validate_city_request_spec.rb +59 -0
- data/spec/models/validate_city_response_spec.rb +65 -0
- data/spec/models/validate_country_request_spec.rb +41 -0
- data/spec/models/validate_country_response_spec.rb +95 -0
- data/spec/models/validate_identifier_request_spec.rb +83 -0
- data/spec/models/validate_identifier_response_spec.rb +47 -0
- data/spec/models/validate_postal_code_request_spec.rb +53 -0
- data/spec/models/validate_postal_code_response_spec.rb +65 -0
- data/spec/models/validate_state_request_spec.rb +53 -0
- data/spec/models/validate_state_response_spec.rb +59 -0
- data/spec/models/validate_url_request_full_spec.rb +41 -0
- data/spec/models/validate_url_request_syntax_only_spec.rb +41 -0
- data/spec/models/validate_url_response_full_spec.rb +65 -0
- data/spec/models/validate_url_response_syntax_only_spec.rb +47 -0
- data/spec/models/vat_lookup_request_spec.rb +41 -0
- data/spec/models/vat_lookup_response_spec.rb +107 -0
- data/spec/models/whois_response_spec.rb +125 -0
- data/spec/spec_helper.rb +111 -0
- metadata +184 -3
@@ -0,0 +1,295 @@
|
|
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
|
+
class VatLookupResponse
|
17
|
+
# Two-letter country code
|
18
|
+
attr_accessor :country_code
|
19
|
+
|
20
|
+
# VAT number
|
21
|
+
attr_accessor :vat_number
|
22
|
+
|
23
|
+
# True if the VAT code is valid, false otherwise
|
24
|
+
attr_accessor :is_valid
|
25
|
+
|
26
|
+
# Name of the business
|
27
|
+
attr_accessor :business_name
|
28
|
+
|
29
|
+
# Business address as a single string
|
30
|
+
attr_accessor :business_address
|
31
|
+
|
32
|
+
# For the business address, the name of the building, house or structure if applicable, such as \"Cloudmersive Building 2\". This will often by null.
|
33
|
+
attr_accessor :business_building
|
34
|
+
|
35
|
+
# For the business address, the street number or house number of the address. For example, in the address \"1600 Pennsylvania Avenue NW\" the street number would be \"1600\". This value will typically be populated for most addresses.
|
36
|
+
attr_accessor :business_street_number
|
37
|
+
|
38
|
+
# For the business address, the name of the street or road of the address. For example, in the address \"1600 Pennsylvania Avenue NW\" the street number would be \"Pennsylvania Avenue NW\".
|
39
|
+
attr_accessor :business_street
|
40
|
+
|
41
|
+
# For the business address, the city of the address.
|
42
|
+
attr_accessor :business_city
|
43
|
+
|
44
|
+
# For the business address, the state or province of the address.
|
45
|
+
attr_accessor :business_state_or_province
|
46
|
+
|
47
|
+
# For the business address, the postal code or zip code of the address.
|
48
|
+
attr_accessor :business_postal_code
|
49
|
+
|
50
|
+
# For the business address, country of the address, if present in the address. If not included in the address it will be null.
|
51
|
+
attr_accessor :business_country
|
52
|
+
|
53
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
54
|
+
def self.attribute_map
|
55
|
+
{
|
56
|
+
:'country_code' => :'CountryCode',
|
57
|
+
:'vat_number' => :'VatNumber',
|
58
|
+
:'is_valid' => :'IsValid',
|
59
|
+
:'business_name' => :'BusinessName',
|
60
|
+
:'business_address' => :'BusinessAddress',
|
61
|
+
:'business_building' => :'BusinessBuilding',
|
62
|
+
:'business_street_number' => :'BusinessStreetNumber',
|
63
|
+
:'business_street' => :'BusinessStreet',
|
64
|
+
:'business_city' => :'BusinessCity',
|
65
|
+
:'business_state_or_province' => :'BusinessStateOrProvince',
|
66
|
+
:'business_postal_code' => :'BusinessPostalCode',
|
67
|
+
:'business_country' => :'BusinessCountry'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# Attribute type mapping.
|
72
|
+
def self.swagger_types
|
73
|
+
{
|
74
|
+
:'country_code' => :'String',
|
75
|
+
:'vat_number' => :'String',
|
76
|
+
:'is_valid' => :'BOOLEAN',
|
77
|
+
:'business_name' => :'String',
|
78
|
+
:'business_address' => :'String',
|
79
|
+
:'business_building' => :'String',
|
80
|
+
:'business_street_number' => :'String',
|
81
|
+
:'business_street' => :'String',
|
82
|
+
:'business_city' => :'String',
|
83
|
+
:'business_state_or_province' => :'String',
|
84
|
+
:'business_postal_code' => :'String',
|
85
|
+
:'business_country' => :'String'
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
# Initializes the object
|
90
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
91
|
+
def initialize(attributes = {})
|
92
|
+
return unless attributes.is_a?(Hash)
|
93
|
+
|
94
|
+
# convert string to symbol for hash key
|
95
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
96
|
+
|
97
|
+
if attributes.has_key?(:'CountryCode')
|
98
|
+
self.country_code = attributes[:'CountryCode']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.has_key?(:'VatNumber')
|
102
|
+
self.vat_number = attributes[:'VatNumber']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.has_key?(:'IsValid')
|
106
|
+
self.is_valid = attributes[:'IsValid']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.has_key?(:'BusinessName')
|
110
|
+
self.business_name = attributes[:'BusinessName']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'BusinessAddress')
|
114
|
+
self.business_address = attributes[:'BusinessAddress']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'BusinessBuilding')
|
118
|
+
self.business_building = attributes[:'BusinessBuilding']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'BusinessStreetNumber')
|
122
|
+
self.business_street_number = attributes[:'BusinessStreetNumber']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'BusinessStreet')
|
126
|
+
self.business_street = attributes[:'BusinessStreet']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'BusinessCity')
|
130
|
+
self.business_city = attributes[:'BusinessCity']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.has_key?(:'BusinessStateOrProvince')
|
134
|
+
self.business_state_or_province = attributes[:'BusinessStateOrProvince']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.has_key?(:'BusinessPostalCode')
|
138
|
+
self.business_postal_code = attributes[:'BusinessPostalCode']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.has_key?(:'BusinessCountry')
|
142
|
+
self.business_country = attributes[:'BusinessCountry']
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
147
|
+
# @return Array for valid properties with the reasons
|
148
|
+
def list_invalid_properties
|
149
|
+
invalid_properties = Array.new
|
150
|
+
invalid_properties
|
151
|
+
end
|
152
|
+
|
153
|
+
# Check to see if the all the properties in the model are valid
|
154
|
+
# @return true if the model is valid
|
155
|
+
def valid?
|
156
|
+
true
|
157
|
+
end
|
158
|
+
|
159
|
+
# Checks equality by comparing each attribute.
|
160
|
+
# @param [Object] Object to be compared
|
161
|
+
def ==(o)
|
162
|
+
return true if self.equal?(o)
|
163
|
+
self.class == o.class &&
|
164
|
+
country_code == o.country_code &&
|
165
|
+
vat_number == o.vat_number &&
|
166
|
+
is_valid == o.is_valid &&
|
167
|
+
business_name == o.business_name &&
|
168
|
+
business_address == o.business_address &&
|
169
|
+
business_building == o.business_building &&
|
170
|
+
business_street_number == o.business_street_number &&
|
171
|
+
business_street == o.business_street &&
|
172
|
+
business_city == o.business_city &&
|
173
|
+
business_state_or_province == o.business_state_or_province &&
|
174
|
+
business_postal_code == o.business_postal_code &&
|
175
|
+
business_country == o.business_country
|
176
|
+
end
|
177
|
+
|
178
|
+
# @see the `==` method
|
179
|
+
# @param [Object] Object to be compared
|
180
|
+
def eql?(o)
|
181
|
+
self == o
|
182
|
+
end
|
183
|
+
|
184
|
+
# Calculates hash code according to all attributes.
|
185
|
+
# @return [Fixnum] Hash code
|
186
|
+
def hash
|
187
|
+
[country_code, vat_number, is_valid, business_name, business_address, business_building, business_street_number, business_street, business_city, business_state_or_province, business_postal_code, business_country].hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Builds the object from hash
|
191
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
192
|
+
# @return [Object] Returns the model itself
|
193
|
+
def build_from_hash(attributes)
|
194
|
+
return nil unless attributes.is_a?(Hash)
|
195
|
+
self.class.swagger_types.each_pair do |key, type|
|
196
|
+
if type =~ /\AArray<(.*)>/i
|
197
|
+
# check to ensure the input is an array given that the attribute
|
198
|
+
# is documented as an array but the input is not
|
199
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
200
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
201
|
+
end
|
202
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
203
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
204
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
205
|
+
end
|
206
|
+
|
207
|
+
self
|
208
|
+
end
|
209
|
+
|
210
|
+
# Deserializes the data based on type
|
211
|
+
# @param string type Data type
|
212
|
+
# @param string value Value to be deserialized
|
213
|
+
# @return [Object] Deserialized data
|
214
|
+
def _deserialize(type, value)
|
215
|
+
case type.to_sym
|
216
|
+
when :DateTime
|
217
|
+
DateTime.parse(value)
|
218
|
+
when :Date
|
219
|
+
Date.parse(value)
|
220
|
+
when :String
|
221
|
+
value.to_s
|
222
|
+
when :Integer
|
223
|
+
value.to_i
|
224
|
+
when :Float
|
225
|
+
value.to_f
|
226
|
+
when :BOOLEAN
|
227
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
228
|
+
true
|
229
|
+
else
|
230
|
+
false
|
231
|
+
end
|
232
|
+
when :Object
|
233
|
+
# generic object (usually a Hash), return directly
|
234
|
+
value
|
235
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
236
|
+
inner_type = Regexp.last_match[:inner_type]
|
237
|
+
value.map { |v| _deserialize(inner_type, v) }
|
238
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
239
|
+
k_type = Regexp.last_match[:k_type]
|
240
|
+
v_type = Regexp.last_match[:v_type]
|
241
|
+
{}.tap do |hash|
|
242
|
+
value.each do |k, v|
|
243
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
else # model
|
247
|
+
temp_model = CloudmersiveValidateApiClient.const_get(type).new
|
248
|
+
temp_model.build_from_hash(value)
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
# Returns the string representation of the object
|
253
|
+
# @return [String] String presentation of the object
|
254
|
+
def to_s
|
255
|
+
to_hash.to_s
|
256
|
+
end
|
257
|
+
|
258
|
+
# to_body is an alias to to_hash (backward compatibility)
|
259
|
+
# @return [Hash] Returns the object in the form of hash
|
260
|
+
def to_body
|
261
|
+
to_hash
|
262
|
+
end
|
263
|
+
|
264
|
+
# Returns the object in the form of hash
|
265
|
+
# @return [Hash] Returns the object in the form of hash
|
266
|
+
def to_hash
|
267
|
+
hash = {}
|
268
|
+
self.class.attribute_map.each_pair do |attr, param|
|
269
|
+
value = self.send(attr)
|
270
|
+
next if value.nil?
|
271
|
+
hash[param] = _to_hash(value)
|
272
|
+
end
|
273
|
+
hash
|
274
|
+
end
|
275
|
+
|
276
|
+
# Outputs non-array value in the form of hash
|
277
|
+
# For object, use to_hash. Otherwise, just return the value
|
278
|
+
# @param [Object] value Any valid value
|
279
|
+
# @return [Hash] Returns the value in the form of hash
|
280
|
+
def _to_hash(value)
|
281
|
+
if value.is_a?(Array)
|
282
|
+
value.compact.map { |v| _to_hash(v) }
|
283
|
+
elsif value.is_a?(Hash)
|
284
|
+
{}.tap do |hash|
|
285
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
286
|
+
end
|
287
|
+
elsif value.respond_to? :to_hash
|
288
|
+
value.to_hash
|
289
|
+
else
|
290
|
+
value
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
end
|
295
|
+
end
|
@@ -0,0 +1,326 @@
|
|
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 a WHOIS operation
|
17
|
+
class WhoisResponse
|
18
|
+
# True if the domain is valid, false if it is not
|
19
|
+
attr_accessor :valid_domain
|
20
|
+
|
21
|
+
# Name of the domain registrant
|
22
|
+
attr_accessor :registrant_name
|
23
|
+
|
24
|
+
# Organization name of the domain registrant
|
25
|
+
attr_accessor :registrant_organization
|
26
|
+
|
27
|
+
# Email address of the domain registrant
|
28
|
+
attr_accessor :registrant_email
|
29
|
+
|
30
|
+
# Street number of the address of the domain registrant, if available
|
31
|
+
attr_accessor :registrant_street_number
|
32
|
+
|
33
|
+
# Street name of the address of the domain registrant, if available
|
34
|
+
attr_accessor :registrant_street
|
35
|
+
|
36
|
+
# City of the domain registrant, if available
|
37
|
+
attr_accessor :registrant_city
|
38
|
+
|
39
|
+
# State or Province of the address of the domain registrant, if available
|
40
|
+
attr_accessor :registrant_state_or_province
|
41
|
+
|
42
|
+
# Postal code of the address of the domain registrant, if available
|
43
|
+
attr_accessor :registrant_postal_code
|
44
|
+
|
45
|
+
# Country of the address of the domain registrant, if available
|
46
|
+
attr_accessor :registrant_country
|
47
|
+
|
48
|
+
# Raw address string of the domain registrant, if available
|
49
|
+
attr_accessor :registrant_raw_address
|
50
|
+
|
51
|
+
# Telephone number of the address of the domain registrant
|
52
|
+
attr_accessor :registrant_telephone
|
53
|
+
|
54
|
+
# Server used to lookup WHOIS information (may change based on lookup).
|
55
|
+
attr_accessor :whois_server
|
56
|
+
|
57
|
+
# WHOIS raw text record
|
58
|
+
attr_accessor :raw_text_record
|
59
|
+
|
60
|
+
# Creation date for the record
|
61
|
+
attr_accessor :created_dt
|
62
|
+
|
63
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
64
|
+
def self.attribute_map
|
65
|
+
{
|
66
|
+
:'valid_domain' => :'ValidDomain',
|
67
|
+
:'registrant_name' => :'RegistrantName',
|
68
|
+
:'registrant_organization' => :'RegistrantOrganization',
|
69
|
+
:'registrant_email' => :'RegistrantEmail',
|
70
|
+
:'registrant_street_number' => :'RegistrantStreetNumber',
|
71
|
+
:'registrant_street' => :'RegistrantStreet',
|
72
|
+
:'registrant_city' => :'RegistrantCity',
|
73
|
+
:'registrant_state_or_province' => :'RegistrantStateOrProvince',
|
74
|
+
:'registrant_postal_code' => :'RegistrantPostalCode',
|
75
|
+
:'registrant_country' => :'RegistrantCountry',
|
76
|
+
:'registrant_raw_address' => :'RegistrantRawAddress',
|
77
|
+
:'registrant_telephone' => :'RegistrantTelephone',
|
78
|
+
:'whois_server' => :'WhoisServer',
|
79
|
+
:'raw_text_record' => :'RawTextRecord',
|
80
|
+
:'created_dt' => :'CreatedDt'
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
# Attribute type mapping.
|
85
|
+
def self.swagger_types
|
86
|
+
{
|
87
|
+
:'valid_domain' => :'BOOLEAN',
|
88
|
+
:'registrant_name' => :'String',
|
89
|
+
:'registrant_organization' => :'String',
|
90
|
+
:'registrant_email' => :'String',
|
91
|
+
:'registrant_street_number' => :'String',
|
92
|
+
:'registrant_street' => :'String',
|
93
|
+
:'registrant_city' => :'String',
|
94
|
+
:'registrant_state_or_province' => :'String',
|
95
|
+
:'registrant_postal_code' => :'String',
|
96
|
+
:'registrant_country' => :'String',
|
97
|
+
:'registrant_raw_address' => :'String',
|
98
|
+
:'registrant_telephone' => :'String',
|
99
|
+
:'whois_server' => :'String',
|
100
|
+
:'raw_text_record' => :'String',
|
101
|
+
:'created_dt' => :'DateTime'
|
102
|
+
}
|
103
|
+
end
|
104
|
+
|
105
|
+
# Initializes the object
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
107
|
+
def initialize(attributes = {})
|
108
|
+
return unless attributes.is_a?(Hash)
|
109
|
+
|
110
|
+
# convert string to symbol for hash key
|
111
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
112
|
+
|
113
|
+
if attributes.has_key?(:'ValidDomain')
|
114
|
+
self.valid_domain = attributes[:'ValidDomain']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'RegistrantName')
|
118
|
+
self.registrant_name = attributes[:'RegistrantName']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'RegistrantOrganization')
|
122
|
+
self.registrant_organization = attributes[:'RegistrantOrganization']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'RegistrantEmail')
|
126
|
+
self.registrant_email = attributes[:'RegistrantEmail']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'RegistrantStreetNumber')
|
130
|
+
self.registrant_street_number = attributes[:'RegistrantStreetNumber']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.has_key?(:'RegistrantStreet')
|
134
|
+
self.registrant_street = attributes[:'RegistrantStreet']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.has_key?(:'RegistrantCity')
|
138
|
+
self.registrant_city = attributes[:'RegistrantCity']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.has_key?(:'RegistrantStateOrProvince')
|
142
|
+
self.registrant_state_or_province = attributes[:'RegistrantStateOrProvince']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.has_key?(:'RegistrantPostalCode')
|
146
|
+
self.registrant_postal_code = attributes[:'RegistrantPostalCode']
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.has_key?(:'RegistrantCountry')
|
150
|
+
self.registrant_country = attributes[:'RegistrantCountry']
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.has_key?(:'RegistrantRawAddress')
|
154
|
+
self.registrant_raw_address = attributes[:'RegistrantRawAddress']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.has_key?(:'RegistrantTelephone')
|
158
|
+
self.registrant_telephone = attributes[:'RegistrantTelephone']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.has_key?(:'WhoisServer')
|
162
|
+
self.whois_server = attributes[:'WhoisServer']
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.has_key?(:'RawTextRecord')
|
166
|
+
self.raw_text_record = attributes[:'RawTextRecord']
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.has_key?(:'CreatedDt')
|
170
|
+
self.created_dt = attributes[:'CreatedDt']
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
175
|
+
# @return Array for valid properties with the reasons
|
176
|
+
def list_invalid_properties
|
177
|
+
invalid_properties = Array.new
|
178
|
+
invalid_properties
|
179
|
+
end
|
180
|
+
|
181
|
+
# Check to see if the all the properties in the model are valid
|
182
|
+
# @return true if the model is valid
|
183
|
+
def valid?
|
184
|
+
true
|
185
|
+
end
|
186
|
+
|
187
|
+
# Checks equality by comparing each attribute.
|
188
|
+
# @param [Object] Object to be compared
|
189
|
+
def ==(o)
|
190
|
+
return true if self.equal?(o)
|
191
|
+
self.class == o.class &&
|
192
|
+
valid_domain == o.valid_domain &&
|
193
|
+
registrant_name == o.registrant_name &&
|
194
|
+
registrant_organization == o.registrant_organization &&
|
195
|
+
registrant_email == o.registrant_email &&
|
196
|
+
registrant_street_number == o.registrant_street_number &&
|
197
|
+
registrant_street == o.registrant_street &&
|
198
|
+
registrant_city == o.registrant_city &&
|
199
|
+
registrant_state_or_province == o.registrant_state_or_province &&
|
200
|
+
registrant_postal_code == o.registrant_postal_code &&
|
201
|
+
registrant_country == o.registrant_country &&
|
202
|
+
registrant_raw_address == o.registrant_raw_address &&
|
203
|
+
registrant_telephone == o.registrant_telephone &&
|
204
|
+
whois_server == o.whois_server &&
|
205
|
+
raw_text_record == o.raw_text_record &&
|
206
|
+
created_dt == o.created_dt
|
207
|
+
end
|
208
|
+
|
209
|
+
# @see the `==` method
|
210
|
+
# @param [Object] Object to be compared
|
211
|
+
def eql?(o)
|
212
|
+
self == o
|
213
|
+
end
|
214
|
+
|
215
|
+
# Calculates hash code according to all attributes.
|
216
|
+
# @return [Fixnum] Hash code
|
217
|
+
def hash
|
218
|
+
[valid_domain, registrant_name, registrant_organization, registrant_email, registrant_street_number, registrant_street, registrant_city, registrant_state_or_province, registrant_postal_code, registrant_country, registrant_raw_address, registrant_telephone, whois_server, raw_text_record, created_dt].hash
|
219
|
+
end
|
220
|
+
|
221
|
+
# Builds the object from hash
|
222
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
223
|
+
# @return [Object] Returns the model itself
|
224
|
+
def build_from_hash(attributes)
|
225
|
+
return nil unless attributes.is_a?(Hash)
|
226
|
+
self.class.swagger_types.each_pair do |key, type|
|
227
|
+
if type =~ /\AArray<(.*)>/i
|
228
|
+
# check to ensure the input is an array given that the attribute
|
229
|
+
# is documented as an array but the input is not
|
230
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
231
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
232
|
+
end
|
233
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
234
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
235
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
236
|
+
end
|
237
|
+
|
238
|
+
self
|
239
|
+
end
|
240
|
+
|
241
|
+
# Deserializes the data based on type
|
242
|
+
# @param string type Data type
|
243
|
+
# @param string value Value to be deserialized
|
244
|
+
# @return [Object] Deserialized data
|
245
|
+
def _deserialize(type, value)
|
246
|
+
case type.to_sym
|
247
|
+
when :DateTime
|
248
|
+
DateTime.parse(value)
|
249
|
+
when :Date
|
250
|
+
Date.parse(value)
|
251
|
+
when :String
|
252
|
+
value.to_s
|
253
|
+
when :Integer
|
254
|
+
value.to_i
|
255
|
+
when :Float
|
256
|
+
value.to_f
|
257
|
+
when :BOOLEAN
|
258
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
259
|
+
true
|
260
|
+
else
|
261
|
+
false
|
262
|
+
end
|
263
|
+
when :Object
|
264
|
+
# generic object (usually a Hash), return directly
|
265
|
+
value
|
266
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
267
|
+
inner_type = Regexp.last_match[:inner_type]
|
268
|
+
value.map { |v| _deserialize(inner_type, v) }
|
269
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
270
|
+
k_type = Regexp.last_match[:k_type]
|
271
|
+
v_type = Regexp.last_match[:v_type]
|
272
|
+
{}.tap do |hash|
|
273
|
+
value.each do |k, v|
|
274
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
else # model
|
278
|
+
temp_model = CloudmersiveValidateApiClient.const_get(type).new
|
279
|
+
temp_model.build_from_hash(value)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
# Returns the string representation of the object
|
284
|
+
# @return [String] String presentation of the object
|
285
|
+
def to_s
|
286
|
+
to_hash.to_s
|
287
|
+
end
|
288
|
+
|
289
|
+
# to_body is an alias to to_hash (backward compatibility)
|
290
|
+
# @return [Hash] Returns the object in the form of hash
|
291
|
+
def to_body
|
292
|
+
to_hash
|
293
|
+
end
|
294
|
+
|
295
|
+
# Returns the object in the form of hash
|
296
|
+
# @return [Hash] Returns the object in the form of hash
|
297
|
+
def to_hash
|
298
|
+
hash = {}
|
299
|
+
self.class.attribute_map.each_pair do |attr, param|
|
300
|
+
value = self.send(attr)
|
301
|
+
next if value.nil?
|
302
|
+
hash[param] = _to_hash(value)
|
303
|
+
end
|
304
|
+
hash
|
305
|
+
end
|
306
|
+
|
307
|
+
# Outputs non-array value in the form of hash
|
308
|
+
# For object, use to_hash. Otherwise, just return the value
|
309
|
+
# @param [Object] value Any valid value
|
310
|
+
# @return [Hash] Returns the value in the form of hash
|
311
|
+
def _to_hash(value)
|
312
|
+
if value.is_a?(Array)
|
313
|
+
value.compact.map { |v| _to_hash(v) }
|
314
|
+
elsif value.is_a?(Hash)
|
315
|
+
{}.tap do |hash|
|
316
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
317
|
+
end
|
318
|
+
elsif value.respond_to? :to_hash
|
319
|
+
value.to_hash
|
320
|
+
else
|
321
|
+
value
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
end
|
326
|
+
end
|