cloudmersive-validate-api-client 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -0
  3. data/README.md +171 -0
  4. data/Rakefile +8 -0
  5. data/cloudmersive-validate-api-client.gemspec +45 -0
  6. data/docs/AddressApi.md +497 -0
  7. data/docs/AddressGetServersResponse.md +9 -0
  8. data/docs/AddressVerifySyntaxOnlyResponse.md +11 -0
  9. data/docs/CheckResponse.md +8 -0
  10. data/docs/CountryDetails.md +11 -0
  11. data/docs/CountryListResult.md +9 -0
  12. data/docs/DomainApi.md +228 -0
  13. data/docs/EmailApi.md +173 -0
  14. data/docs/FirstNameValidationRequest.md +8 -0
  15. data/docs/FirstNameValidationResponse.md +9 -0
  16. data/docs/FullEmailValidationResponse.md +16 -0
  17. data/docs/FullNameValidationRequest.md +8 -0
  18. data/docs/FullNameValidationResponse.md +17 -0
  19. data/docs/GeolocateResponse.md +16 -0
  20. data/docs/GetGenderRequest.md +9 -0
  21. data/docs/GetGenderResponse.md +9 -0
  22. data/docs/GetTimezonesRequest.md +8 -0
  23. data/docs/GetTimezonesResponse.md +13 -0
  24. data/docs/IPAddressApi.md +63 -0
  25. data/docs/LastNameValidationRequest.md +8 -0
  26. data/docs/LastNameValidationResponse.md +9 -0
  27. data/docs/LeadEnrichmentApi.md +61 -0
  28. data/docs/LeadEnrichmentRequest.md +21 -0
  29. data/docs/LeadEnrichmentResponse.md +25 -0
  30. data/docs/NameApi.md +283 -0
  31. data/docs/ParseAddressRequest.md +9 -0
  32. data/docs/ParseAddressResponse.md +16 -0
  33. data/docs/PhoneNumberApi.md +63 -0
  34. data/docs/PhoneNumberValidateRequest.md +9 -0
  35. data/docs/PhoneNumberValidationResponse.md +15 -0
  36. data/docs/Timezone.md +10 -0
  37. data/docs/UserAgentApi.md +63 -0
  38. data/docs/UserAgentValidateRequest.md +8 -0
  39. data/docs/UserAgentValidateResponse.md +21 -0
  40. data/docs/ValidateAddressRequest.md +13 -0
  41. data/docs/ValidateAddressResponse.md +10 -0
  42. data/docs/ValidateCityRequest.md +11 -0
  43. data/docs/ValidateCityResponse.md +12 -0
  44. data/docs/ValidateCountryRequest.md +8 -0
  45. data/docs/ValidateCountryResponse.md +14 -0
  46. data/docs/ValidateIdentifierRequest.md +15 -0
  47. data/docs/ValidateIdentifierResponse.md +9 -0
  48. data/docs/ValidatePostalCodeRequest.md +10 -0
  49. data/docs/ValidatePostalCodeResponse.md +12 -0
  50. data/docs/ValidateStateRequest.md +10 -0
  51. data/docs/ValidateStateResponse.md +11 -0
  52. data/docs/ValidateUrlRequestFull.md +8 -0
  53. data/docs/ValidateUrlRequestSyntaxOnly.md +8 -0
  54. data/docs/ValidateUrlResponseFull.md +12 -0
  55. data/docs/ValidateUrlResponseSyntaxOnly.md +9 -0
  56. data/docs/VatApi.md +63 -0
  57. data/docs/VatLookupRequest.md +8 -0
  58. data/docs/VatLookupResponse.md +19 -0
  59. data/docs/WhoisResponse.md +22 -0
  60. data/git_push.sh +55 -0
  61. data/lib/cloudmersive-validate-api-client.rb +93 -0
  62. data/lib/cloudmersive-validate-api-client/api/address_api.rb +501 -0
  63. data/lib/cloudmersive-validate-api-client/api/domain_api.rb +239 -0
  64. data/lib/cloudmersive-validate-api-client/api/email_api.rb +185 -0
  65. data/lib/cloudmersive-validate-api-client/api/ip_address_api.rb +77 -0
  66. data/lib/cloudmersive-validate-api-client/api/lead_enrichment_api.rb +75 -0
  67. data/lib/cloudmersive-validate-api-client/api/name_api.rb +293 -0
  68. data/lib/cloudmersive-validate-api-client/api/phone_number_api.rb +77 -0
  69. data/lib/cloudmersive-validate-api-client/api/user_agent_api.rb +77 -0
  70. data/lib/cloudmersive-validate-api-client/api/vat_api.rb +77 -0
  71. data/lib/cloudmersive-validate-api-client/api_client.rb +391 -0
  72. data/lib/cloudmersive-validate-api-client/api_error.rb +38 -0
  73. data/lib/cloudmersive-validate-api-client/configuration.rb +209 -0
  74. data/lib/cloudmersive-validate-api-client/models/address_get_servers_response.rb +198 -0
  75. data/lib/cloudmersive-validate-api-client/models/address_verify_syntax_only_response.rb +216 -0
  76. data/lib/cloudmersive-validate-api-client/models/check_response.rb +186 -0
  77. data/lib/cloudmersive-validate-api-client/models/country_details.rb +216 -0
  78. data/lib/cloudmersive-validate-api-client/models/country_list_result.rb +198 -0
  79. data/lib/cloudmersive-validate-api-client/models/first_name_validation_request.rb +186 -0
  80. data/lib/cloudmersive-validate-api-client/models/first_name_validation_response.rb +196 -0
  81. data/lib/cloudmersive-validate-api-client/models/full_email_validation_response.rb +266 -0
  82. data/lib/cloudmersive-validate-api-client/models/full_name_validation_request.rb +186 -0
  83. data/lib/cloudmersive-validate-api-client/models/full_name_validation_response.rb +276 -0
  84. data/lib/cloudmersive-validate-api-client/models/geolocate_response.rb +266 -0
  85. data/lib/cloudmersive-validate-api-client/models/get_gender_request.rb +196 -0
  86. data/lib/cloudmersive-validate-api-client/models/get_gender_response.rb +196 -0
  87. data/lib/cloudmersive-validate-api-client/models/get_timezones_request.rb +186 -0
  88. data/lib/cloudmersive-validate-api-client/models/get_timezones_response.rb +238 -0
  89. data/lib/cloudmersive-validate-api-client/models/last_name_validation_request.rb +186 -0
  90. data/lib/cloudmersive-validate-api-client/models/last_name_validation_response.rb +196 -0
  91. data/lib/cloudmersive-validate-api-client/models/lead_enrichment_request.rb +316 -0
  92. data/lib/cloudmersive-validate-api-client/models/lead_enrichment_response.rb +356 -0
  93. data/lib/cloudmersive-validate-api-client/models/parse_address_request.rb +196 -0
  94. data/lib/cloudmersive-validate-api-client/models/parse_address_response.rb +266 -0
  95. data/lib/cloudmersive-validate-api-client/models/phone_number_validate_request.rb +196 -0
  96. data/lib/cloudmersive-validate-api-client/models/phone_number_validation_response.rb +256 -0
  97. data/lib/cloudmersive-validate-api-client/models/timezone.rb +206 -0
  98. data/lib/cloudmersive-validate-api-client/models/user_agent_validate_request.rb +186 -0
  99. data/lib/cloudmersive-validate-api-client/models/user_agent_validate_response.rb +316 -0
  100. data/lib/cloudmersive-validate-api-client/models/validate_address_request.rb +236 -0
  101. data/lib/cloudmersive-validate-api-client/models/validate_address_response.rb +206 -0
  102. data/lib/cloudmersive-validate-api-client/models/validate_city_request.rb +216 -0
  103. data/lib/cloudmersive-validate-api-client/models/validate_city_response.rb +226 -0
  104. data/lib/cloudmersive-validate-api-client/models/validate_country_request.rb +186 -0
  105. data/lib/cloudmersive-validate-api-client/models/validate_country_response.rb +248 -0
  106. data/lib/cloudmersive-validate-api-client/models/validate_identifier_request.rb +256 -0
  107. data/lib/cloudmersive-validate-api-client/models/validate_identifier_response.rb +196 -0
  108. data/lib/cloudmersive-validate-api-client/models/validate_postal_code_request.rb +206 -0
  109. data/lib/cloudmersive-validate-api-client/models/validate_postal_code_response.rb +226 -0
  110. data/lib/cloudmersive-validate-api-client/models/validate_state_request.rb +206 -0
  111. data/lib/cloudmersive-validate-api-client/models/validate_state_response.rb +216 -0
  112. data/lib/cloudmersive-validate-api-client/models/validate_url_request_full.rb +186 -0
  113. data/lib/cloudmersive-validate-api-client/models/validate_url_request_syntax_only.rb +186 -0
  114. data/lib/cloudmersive-validate-api-client/models/validate_url_response_full.rb +226 -0
  115. data/lib/cloudmersive-validate-api-client/models/validate_url_response_syntax_only.rb +196 -0
  116. data/lib/cloudmersive-validate-api-client/models/vat_lookup_request.rb +186 -0
  117. data/lib/cloudmersive-validate-api-client/models/vat_lookup_response.rb +295 -0
  118. data/lib/cloudmersive-validate-api-client/models/whois_response.rb +326 -0
  119. data/lib/cloudmersive-validate-api-client/version.rb +15 -0
  120. data/spec/api/address_api_spec.rb +142 -0
  121. data/spec/api/domain_api_spec.rb +83 -0
  122. data/spec/api/email_api_spec.rb +71 -0
  123. data/spec/api/ip_address_api_spec.rb +47 -0
  124. data/spec/api/lead_enrichment_api_spec.rb +46 -0
  125. data/spec/api/name_api_spec.rb +95 -0
  126. data/spec/api/phone_number_api_spec.rb +47 -0
  127. data/spec/api/user_agent_api_spec.rb +47 -0
  128. data/spec/api/vat_api_spec.rb +47 -0
  129. data/spec/api_client_spec.rb +243 -0
  130. data/spec/configuration_spec.rb +42 -0
  131. data/spec/models/address_get_servers_response_spec.rb +47 -0
  132. data/spec/models/address_verify_syntax_only_response_spec.rb +59 -0
  133. data/spec/models/check_response_spec.rb +41 -0
  134. data/spec/models/country_details_spec.rb +59 -0
  135. data/spec/models/country_list_result_spec.rb +47 -0
  136. data/spec/models/first_name_validation_request_spec.rb +41 -0
  137. data/spec/models/first_name_validation_response_spec.rb +47 -0
  138. data/spec/models/full_email_validation_response_spec.rb +89 -0
  139. data/spec/models/full_name_validation_request_spec.rb +41 -0
  140. data/spec/models/full_name_validation_response_spec.rb +95 -0
  141. data/spec/models/geolocate_response_spec.rb +89 -0
  142. data/spec/models/get_gender_request_spec.rb +47 -0
  143. data/spec/models/get_gender_response_spec.rb +47 -0
  144. data/spec/models/get_timezones_request_spec.rb +41 -0
  145. data/spec/models/get_timezones_response_spec.rb +71 -0
  146. data/spec/models/last_name_validation_request_spec.rb +41 -0
  147. data/spec/models/last_name_validation_response_spec.rb +47 -0
  148. data/spec/models/lead_enrichment_request_spec.rb +119 -0
  149. data/spec/models/lead_enrichment_response_spec.rb +143 -0
  150. data/spec/models/parse_address_request_spec.rb +47 -0
  151. data/spec/models/parse_address_response_spec.rb +89 -0
  152. data/spec/models/phone_number_validate_request_spec.rb +47 -0
  153. data/spec/models/phone_number_validation_response_spec.rb +83 -0
  154. data/spec/models/timezone_spec.rb +53 -0
  155. data/spec/models/user_agent_validate_request_spec.rb +41 -0
  156. data/spec/models/user_agent_validate_response_spec.rb +119 -0
  157. data/spec/models/validate_address_request_spec.rb +71 -0
  158. data/spec/models/validate_address_response_spec.rb +53 -0
  159. data/spec/models/validate_city_request_spec.rb +59 -0
  160. data/spec/models/validate_city_response_spec.rb +65 -0
  161. data/spec/models/validate_country_request_spec.rb +41 -0
  162. data/spec/models/validate_country_response_spec.rb +77 -0
  163. data/spec/models/validate_identifier_request_spec.rb +83 -0
  164. data/spec/models/validate_identifier_response_spec.rb +47 -0
  165. data/spec/models/validate_postal_code_request_spec.rb +53 -0
  166. data/spec/models/validate_postal_code_response_spec.rb +65 -0
  167. data/spec/models/validate_state_request_spec.rb +53 -0
  168. data/spec/models/validate_state_response_spec.rb +59 -0
  169. data/spec/models/validate_url_request_full_spec.rb +41 -0
  170. data/spec/models/validate_url_request_syntax_only_spec.rb +41 -0
  171. data/spec/models/validate_url_response_full_spec.rb +65 -0
  172. data/spec/models/validate_url_response_syntax_only_spec.rb +47 -0
  173. data/spec/models/vat_lookup_request_spec.rb +41 -0
  174. data/spec/models/vat_lookup_response_spec.rb +107 -0
  175. data/spec/models/whois_response_spec.rb +125 -0
  176. data/spec/spec_helper.rb +111 -0
  177. metadata +177 -2
@@ -0,0 +1,226 @@
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 validating a city
17
+ class ValidateCityResponse
18
+ # True if the city is valid, false otherwise
19
+ attr_accessor :valid_city
20
+
21
+ # If valid, City corresponding to the input postal code, such as 'Walnut Creek'
22
+ attr_accessor :city
23
+
24
+ # If valid; State or province corresponding to the input state name, such as 'CA' or 'California'
25
+ attr_accessor :state_or_province
26
+
27
+ # If the postal code is valid, the degrees latitude of the centroid of the state, null otherwise
28
+ attr_accessor :latitude
29
+
30
+ # If the postal code is valid, the degrees longitude of the centroid of the state, null otherwise
31
+ attr_accessor :longitude
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'valid_city' => :'ValidCity',
37
+ :'city' => :'City',
38
+ :'state_or_province' => :'StateOrProvince',
39
+ :'latitude' => :'Latitude',
40
+ :'longitude' => :'Longitude'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'valid_city' => :'BOOLEAN',
48
+ :'city' => :'String',
49
+ :'state_or_province' => :'String',
50
+ :'latitude' => :'Float',
51
+ :'longitude' => :'Float'
52
+ }
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ return unless attributes.is_a?(Hash)
59
+
60
+ # convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
62
+
63
+ if attributes.has_key?(:'ValidCity')
64
+ self.valid_city = attributes[:'ValidCity']
65
+ end
66
+
67
+ if attributes.has_key?(:'City')
68
+ self.city = attributes[:'City']
69
+ end
70
+
71
+ if attributes.has_key?(:'StateOrProvince')
72
+ self.state_or_province = attributes[:'StateOrProvince']
73
+ end
74
+
75
+ if attributes.has_key?(:'Latitude')
76
+ self.latitude = attributes[:'Latitude']
77
+ end
78
+
79
+ if attributes.has_key?(:'Longitude')
80
+ self.longitude = attributes[:'Longitude']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ valid_city == o.valid_city &&
103
+ city == o.city &&
104
+ state_or_province == o.state_or_province &&
105
+ latitude == o.latitude &&
106
+ longitude == o.longitude
107
+ end
108
+
109
+ # @see the `==` method
110
+ # @param [Object] Object to be compared
111
+ def eql?(o)
112
+ self == o
113
+ end
114
+
115
+ # Calculates hash code according to all attributes.
116
+ # @return [Fixnum] Hash code
117
+ def hash
118
+ [valid_city, city, state_or_province, latitude, longitude].hash
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.swagger_types.each_pair do |key, type|
127
+ if type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def _deserialize(type, value)
146
+ case type.to_sym
147
+ when :DateTime
148
+ DateTime.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :BOOLEAN
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
179
+ temp_model.build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ next if value.nil?
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
225
+ end
226
+ end
@@ -0,0 +1,186 @@
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 ValidateCountryRequest
18
+ # Raw country input - can be a two-letter code (FIPS 10-4 or ISO 3166-1), three-letter code (ISO 3166-1) or country name
19
+ attr_accessor :raw_country_input
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'raw_country_input' => :'RawCountryInput'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'raw_country_input' => :'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?(:'RawCountryInput')
44
+ self.raw_country_input = attributes[:'RawCountryInput']
45
+ end
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properties with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ raw_country_input == o.raw_country_input
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Fixnum] Hash code
77
+ def hash
78
+ [raw_country_input].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def build_from_hash(attributes)
85
+ return nil unless attributes.is_a?(Hash)
86
+ self.class.swagger_types.each_pair do |key, type|
87
+ if type =~ /\AArray<(.*)>/i
88
+ # check to ensure the input is an array given that the attribute
89
+ # is documented as an array but the input is not
90
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
91
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
92
+ end
93
+ elsif !attributes[self.class.attribute_map[key]].nil?
94
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
95
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
96
+ end
97
+
98
+ self
99
+ end
100
+
101
+ # Deserializes the data based on type
102
+ # @param string type Data type
103
+ # @param string value Value to be deserialized
104
+ # @return [Object] Deserialized data
105
+ def _deserialize(type, value)
106
+ case type.to_sym
107
+ when :DateTime
108
+ DateTime.parse(value)
109
+ when :Date
110
+ Date.parse(value)
111
+ when :String
112
+ value.to_s
113
+ when :Integer
114
+ value.to_i
115
+ when :Float
116
+ value.to_f
117
+ when :BOOLEAN
118
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
119
+ true
120
+ else
121
+ false
122
+ end
123
+ when :Object
124
+ # generic object (usually a Hash), return directly
125
+ value
126
+ when /\AArray<(?<inner_type>.+)>\z/
127
+ inner_type = Regexp.last_match[:inner_type]
128
+ value.map { |v| _deserialize(inner_type, v) }
129
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
130
+ k_type = Regexp.last_match[:k_type]
131
+ v_type = Regexp.last_match[:v_type]
132
+ {}.tap do |hash|
133
+ value.each do |k, v|
134
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
135
+ end
136
+ end
137
+ else # model
138
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
139
+ temp_model.build_from_hash(value)
140
+ end
141
+ end
142
+
143
+ # Returns the string representation of the object
144
+ # @return [String] String presentation of the object
145
+ def to_s
146
+ to_hash.to_s
147
+ end
148
+
149
+ # to_body is an alias to to_hash (backward compatibility)
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_body
152
+ to_hash
153
+ end
154
+
155
+ # Returns the object in the form of hash
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_hash
158
+ hash = {}
159
+ self.class.attribute_map.each_pair do |attr, param|
160
+ value = self.send(attr)
161
+ next if value.nil?
162
+ hash[param] = _to_hash(value)
163
+ end
164
+ hash
165
+ end
166
+
167
+ # Outputs non-array value in the form of hash
168
+ # For object, use to_hash. Otherwise, just return the value
169
+ # @param [Object] value Any valid value
170
+ # @return [Hash] Returns the value in the form of hash
171
+ def _to_hash(value)
172
+ if value.is_a?(Array)
173
+ value.compact.map { |v| _to_hash(v) }
174
+ elsif value.is_a?(Hash)
175
+ {}.tap do |hash|
176
+ value.each { |k, v| hash[k] = _to_hash(v) }
177
+ end
178
+ elsif value.respond_to? :to_hash
179
+ value.to_hash
180
+ else
181
+ value
182
+ end
183
+ end
184
+
185
+ end
186
+ end
@@ -0,0 +1,248 @@
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 performing a country validation operation
17
+ class ValidateCountryResponse
18
+ # True if successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Full name of the country
22
+ attr_accessor :country_full_name
23
+
24
+ # Two-letter ISO 3166-1 country code
25
+ attr_accessor :iso_two_letter_code
26
+
27
+ # Two-letter FIPS 10-4 country code
28
+ attr_accessor :fips_two_letter_code
29
+
30
+ # Three-letter ISO 3166-1 country code
31
+ attr_accessor :three_letter_code
32
+
33
+ # True if this country is currently a member of the European Union (EU), false otherwise
34
+ attr_accessor :is_european_union_member
35
+
36
+ # Time zones (IANA/Olsen) in the country
37
+ attr_accessor :timezones
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'successful' => :'Successful',
43
+ :'country_full_name' => :'CountryFullName',
44
+ :'iso_two_letter_code' => :'ISOTwoLetterCode',
45
+ :'fips_two_letter_code' => :'FIPSTwoLetterCode',
46
+ :'three_letter_code' => :'ThreeLetterCode',
47
+ :'is_european_union_member' => :'IsEuropeanUnionMember',
48
+ :'timezones' => :'Timezones'
49
+ }
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.swagger_types
54
+ {
55
+ :'successful' => :'BOOLEAN',
56
+ :'country_full_name' => :'String',
57
+ :'iso_two_letter_code' => :'String',
58
+ :'fips_two_letter_code' => :'String',
59
+ :'three_letter_code' => :'String',
60
+ :'is_european_union_member' => :'BOOLEAN',
61
+ :'timezones' => :'Array<Timezone>'
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?(:'CountryFullName')
78
+ self.country_full_name = attributes[:'CountryFullName']
79
+ end
80
+
81
+ if attributes.has_key?(:'ISOTwoLetterCode')
82
+ self.iso_two_letter_code = attributes[:'ISOTwoLetterCode']
83
+ end
84
+
85
+ if attributes.has_key?(:'FIPSTwoLetterCode')
86
+ self.fips_two_letter_code = attributes[:'FIPSTwoLetterCode']
87
+ end
88
+
89
+ if attributes.has_key?(:'ThreeLetterCode')
90
+ self.three_letter_code = attributes[:'ThreeLetterCode']
91
+ end
92
+
93
+ if attributes.has_key?(:'IsEuropeanUnionMember')
94
+ self.is_european_union_member = attributes[:'IsEuropeanUnionMember']
95
+ end
96
+
97
+ if attributes.has_key?(:'Timezones')
98
+ if (value = attributes[:'Timezones']).is_a?(Array)
99
+ self.timezones = value
100
+ end
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ true
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ successful == o.successful &&
123
+ country_full_name == o.country_full_name &&
124
+ iso_two_letter_code == o.iso_two_letter_code &&
125
+ fips_two_letter_code == o.fips_two_letter_code &&
126
+ three_letter_code == o.three_letter_code &&
127
+ is_european_union_member == o.is_european_union_member &&
128
+ timezones == o.timezones
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Fixnum] Hash code
139
+ def hash
140
+ [successful, country_full_name, iso_two_letter_code, fips_two_letter_code, three_letter_code, is_european_union_member, timezones].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ self.class.swagger_types.each_pair do |key, type|
149
+ if type =~ /\AArray<(.*)>/i
150
+ # check to ensure the input is an array given that the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
153
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
154
+ end
155
+ elsif !attributes[self.class.attribute_map[key]].nil?
156
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
157
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
158
+ end
159
+
160
+ self
161
+ end
162
+
163
+ # Deserializes the data based on type
164
+ # @param string type Data type
165
+ # @param string value Value to be deserialized
166
+ # @return [Object] Deserialized data
167
+ def _deserialize(type, value)
168
+ case type.to_sym
169
+ when :DateTime
170
+ DateTime.parse(value)
171
+ when :Date
172
+ Date.parse(value)
173
+ when :String
174
+ value.to_s
175
+ when :Integer
176
+ value.to_i
177
+ when :Float
178
+ value.to_f
179
+ when :BOOLEAN
180
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
+ true
182
+ else
183
+ false
184
+ end
185
+ when :Object
186
+ # generic object (usually a Hash), return directly
187
+ value
188
+ when /\AArray<(?<inner_type>.+)>\z/
189
+ inner_type = Regexp.last_match[:inner_type]
190
+ value.map { |v| _deserialize(inner_type, v) }
191
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
+ k_type = Regexp.last_match[:k_type]
193
+ v_type = Regexp.last_match[:v_type]
194
+ {}.tap do |hash|
195
+ value.each do |k, v|
196
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
+ end
198
+ end
199
+ else # model
200
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
201
+ temp_model.build_from_hash(value)
202
+ end
203
+ end
204
+
205
+ # Returns the string representation of the object
206
+ # @return [String] String presentation of the object
207
+ def to_s
208
+ to_hash.to_s
209
+ end
210
+
211
+ # to_body is an alias to to_hash (backward compatibility)
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_body
214
+ to_hash
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ next if value.nil?
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+
247
+ end
248
+ end