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,256 @@
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 from validating a phone number
17
+ class PhoneNumberValidationResponse
18
+ # True if the phone number is valid, false otherwise
19
+ attr_accessor :is_valid
20
+
21
+ # True if the operation was successful, false if there was an error during validation. See IsValid for validation result.
22
+ attr_accessor :successful
23
+
24
+ # Type of phone number; possible values are: FixedLine, Mobile, FixedLineOrMobile, TollFree, PremiumRate, SharedCost, Voip, PersonalNumber, Pager, Uan, Voicemail, Unknown
25
+ attr_accessor :phone_number_type
26
+
27
+ # E.164 format of the phone number
28
+ attr_accessor :e164_format
29
+
30
+ # Internaltional format of the phone number
31
+ attr_accessor :international_format
32
+
33
+ # National format of the phone number
34
+ attr_accessor :national_format
35
+
36
+ # Two digit country code of the phone number
37
+ attr_accessor :country_code
38
+
39
+ # User-friendly long name of the country for the phone number
40
+ attr_accessor :country_name
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'is_valid' => :'IsValid',
46
+ :'successful' => :'Successful',
47
+ :'phone_number_type' => :'PhoneNumberType',
48
+ :'e164_format' => :'E164Format',
49
+ :'international_format' => :'InternationalFormat',
50
+ :'national_format' => :'NationalFormat',
51
+ :'country_code' => :'CountryCode',
52
+ :'country_name' => :'CountryName'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'is_valid' => :'BOOLEAN',
60
+ :'successful' => :'BOOLEAN',
61
+ :'phone_number_type' => :'String',
62
+ :'e164_format' => :'String',
63
+ :'international_format' => :'String',
64
+ :'national_format' => :'String',
65
+ :'country_code' => :'String',
66
+ :'country_name' => :'String'
67
+ }
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ return unless attributes.is_a?(Hash)
74
+
75
+ # convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
77
+
78
+ if attributes.has_key?(:'IsValid')
79
+ self.is_valid = attributes[:'IsValid']
80
+ end
81
+
82
+ if attributes.has_key?(:'Successful')
83
+ self.successful = attributes[:'Successful']
84
+ end
85
+
86
+ if attributes.has_key?(:'PhoneNumberType')
87
+ self.phone_number_type = attributes[:'PhoneNumberType']
88
+ end
89
+
90
+ if attributes.has_key?(:'E164Format')
91
+ self.e164_format = attributes[:'E164Format']
92
+ end
93
+
94
+ if attributes.has_key?(:'InternationalFormat')
95
+ self.international_format = attributes[:'InternationalFormat']
96
+ end
97
+
98
+ if attributes.has_key?(:'NationalFormat')
99
+ self.national_format = attributes[:'NationalFormat']
100
+ end
101
+
102
+ if attributes.has_key?(:'CountryCode')
103
+ self.country_code = attributes[:'CountryCode']
104
+ end
105
+
106
+ if attributes.has_key?(:'CountryName')
107
+ self.country_name = attributes[:'CountryName']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ invalid_properties = Array.new
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ is_valid == o.is_valid &&
130
+ successful == o.successful &&
131
+ phone_number_type == o.phone_number_type &&
132
+ e164_format == o.e164_format &&
133
+ international_format == o.international_format &&
134
+ national_format == o.national_format &&
135
+ country_code == o.country_code &&
136
+ country_name == o.country_name
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Fixnum] Hash code
147
+ def hash
148
+ [is_valid, successful, phone_number_type, e164_format, international_format, national_format, country_code, country_name].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.swagger_types.each_pair do |key, type|
157
+ if type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
161
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
166
+ end
167
+
168
+ self
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def _deserialize(type, value)
176
+ case type.to_sym
177
+ when :DateTime
178
+ DateTime.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :BOOLEAN
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
209
+ temp_model.build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ next if value.nil?
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+
255
+ end
256
+ end
@@ -0,0 +1,206 @@
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
+ # IANA/Olsen time zone
17
+ class Timezone
18
+ # Name of the Time Zone
19
+ attr_accessor :name
20
+
21
+ # UTC offset for this time zone
22
+ attr_accessor :base_utc_offset
23
+
24
+ # The current time (Now) in this time zone
25
+ attr_accessor :now
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'name' => :'Name',
31
+ :'base_utc_offset' => :'BaseUTCOffset',
32
+ :'now' => :'Now'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'name' => :'String',
40
+ :'base_utc_offset' => :'String',
41
+ :'now' => :'DateTime'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
52
+
53
+ if attributes.has_key?(:'Name')
54
+ self.name = attributes[:'Name']
55
+ end
56
+
57
+ if attributes.has_key?(:'BaseUTCOffset')
58
+ self.base_utc_offset = attributes[:'BaseUTCOffset']
59
+ end
60
+
61
+ if attributes.has_key?(:'Now')
62
+ self.now = attributes[:'Now']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ name == o.name &&
85
+ base_utc_offset == o.base_utc_offset &&
86
+ now == o.now
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Fixnum] Hash code
97
+ def hash
98
+ [name, base_utc_offset, now].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.swagger_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :BOOLEAN
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
159
+ temp_model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+
205
+ end
206
+ end