cloudmersive-validate-api-client 1.2.9 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -4
  3. data/docs/FirstNameValidationRequest.md +8 -0
  4. data/docs/FirstNameValidationResponse.md +9 -0
  5. data/docs/FullNameValidationRequest.md +8 -0
  6. data/docs/FullNameValidationResponse.md +17 -0
  7. data/docs/GetGenderRequest.md +9 -0
  8. data/docs/GetGenderResponse.md +9 -0
  9. data/docs/LastNameValidationRequest.md +8 -0
  10. data/docs/LastNameValidationResponse.md +9 -0
  11. data/docs/NameApi.md +228 -0
  12. data/lib/cloudmersive-validate-api-client.rb +9 -0
  13. data/lib/cloudmersive-validate-api-client/api/name_api.rb +243 -0
  14. data/lib/cloudmersive-validate-api-client/models/first_name_validation_request.rb +189 -0
  15. data/lib/cloudmersive-validate-api-client/models/first_name_validation_response.rb +199 -0
  16. data/lib/cloudmersive-validate-api-client/models/full_name_validation_request.rb +189 -0
  17. data/lib/cloudmersive-validate-api-client/models/full_name_validation_response.rb +279 -0
  18. data/lib/cloudmersive-validate-api-client/models/get_gender_request.rb +199 -0
  19. data/lib/cloudmersive-validate-api-client/models/get_gender_response.rb +199 -0
  20. data/lib/cloudmersive-validate-api-client/models/last_name_validation_request.rb +189 -0
  21. data/lib/cloudmersive-validate-api-client/models/last_name_validation_response.rb +199 -0
  22. data/lib/cloudmersive-validate-api-client/version.rb +1 -1
  23. data/spec/api/name_api_spec.rb +83 -0
  24. data/spec/models/first_name_validation_request_spec.rb +42 -0
  25. data/spec/models/first_name_validation_response_spec.rb +48 -0
  26. data/spec/models/full_name_validation_request_spec.rb +42 -0
  27. data/spec/models/full_name_validation_response_spec.rb +96 -0
  28. data/spec/models/get_gender_request_spec.rb +48 -0
  29. data/spec/models/get_gender_response_spec.rb +48 -0
  30. data/spec/models/last_name_validation_request_spec.rb +42 -0
  31. data/spec/models/last_name_validation_response_spec.rb +48 -0
  32. metadata +29 -2
@@ -0,0 +1,279 @@
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: unset
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveValidateApiClient
16
+ # Result of a full name validation operation
17
+ class FullNameValidationResponse
18
+ # True if the validation operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Possible values are: ValidFirstName, ValidUnknownFirstName, InvalidSpamInput, InvalidCharacters, InvalidEmpty
22
+ attr_accessor :validation_result_first_name
23
+
24
+ # Possible values are: ValidLastName, ValidUnknownLastName, InvalidSpamInput, InvalidCharacters, InvalidEmpty
25
+ attr_accessor :validation_result_last_name
26
+
27
+ # The person's title (if supplied), e.g. \"Mr.\" or \"Ms.\"
28
+ attr_accessor :title
29
+
30
+ # The first name (given name)
31
+ attr_accessor :first_name
32
+
33
+ # The middle name(s); if there are multiple names they will be separated by spaces
34
+ attr_accessor :middle_name
35
+
36
+ # The last name (surname)
37
+ attr_accessor :last_name
38
+
39
+ # Nickname (if supplied)
40
+ attr_accessor :nick_name
41
+
42
+ # Suffix to the name, e.g. \"Jr.\" or \"Sr.\"
43
+ attr_accessor :suffix
44
+
45
+ # The full display name of the name
46
+ attr_accessor :display_name
47
+
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'successful' => :'Successful',
53
+ :'validation_result_first_name' => :'ValidationResult_FirstName',
54
+ :'validation_result_last_name' => :'ValidationResult_LastName',
55
+ :'title' => :'Title',
56
+ :'first_name' => :'FirstName',
57
+ :'middle_name' => :'MiddleName',
58
+ :'last_name' => :'LastName',
59
+ :'nick_name' => :'NickName',
60
+ :'suffix' => :'Suffix',
61
+ :'display_name' => :'DisplayName'
62
+ }
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.swagger_types
67
+ {
68
+ :'successful' => :'BOOLEAN',
69
+ :'validation_result_first_name' => :'String',
70
+ :'validation_result_last_name' => :'String',
71
+ :'title' => :'String',
72
+ :'first_name' => :'String',
73
+ :'middle_name' => :'String',
74
+ :'last_name' => :'String',
75
+ :'nick_name' => :'String',
76
+ :'suffix' => :'String',
77
+ :'display_name' => :'String'
78
+ }
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ return unless attributes.is_a?(Hash)
85
+
86
+ # convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
88
+
89
+ if attributes.has_key?(:'Successful')
90
+ self.successful = attributes[:'Successful']
91
+ end
92
+
93
+ if attributes.has_key?(:'ValidationResult_FirstName')
94
+ self.validation_result_first_name = attributes[:'ValidationResult_FirstName']
95
+ end
96
+
97
+ if attributes.has_key?(:'ValidationResult_LastName')
98
+ self.validation_result_last_name = attributes[:'ValidationResult_LastName']
99
+ end
100
+
101
+ if attributes.has_key?(:'Title')
102
+ self.title = attributes[:'Title']
103
+ end
104
+
105
+ if attributes.has_key?(:'FirstName')
106
+ self.first_name = attributes[:'FirstName']
107
+ end
108
+
109
+ if attributes.has_key?(:'MiddleName')
110
+ self.middle_name = attributes[:'MiddleName']
111
+ end
112
+
113
+ if attributes.has_key?(:'LastName')
114
+ self.last_name = attributes[:'LastName']
115
+ end
116
+
117
+ if attributes.has_key?(:'NickName')
118
+ self.nick_name = attributes[:'NickName']
119
+ end
120
+
121
+ if attributes.has_key?(:'Suffix')
122
+ self.suffix = attributes[:'Suffix']
123
+ end
124
+
125
+ if attributes.has_key?(:'DisplayName')
126
+ self.display_name = attributes[:'DisplayName']
127
+ end
128
+
129
+ end
130
+
131
+ # Show invalid properties with the reasons. Usually used together with valid?
132
+ # @return Array for valid properties with the reasons
133
+ def list_invalid_properties
134
+ invalid_properties = Array.new
135
+ return invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ return true
142
+ end
143
+
144
+ # Checks equality by comparing each attribute.
145
+ # @param [Object] Object to be compared
146
+ def ==(o)
147
+ return true if self.equal?(o)
148
+ self.class == o.class &&
149
+ successful == o.successful &&
150
+ validation_result_first_name == o.validation_result_first_name &&
151
+ validation_result_last_name == o.validation_result_last_name &&
152
+ title == o.title &&
153
+ first_name == o.first_name &&
154
+ middle_name == o.middle_name &&
155
+ last_name == o.last_name &&
156
+ nick_name == o.nick_name &&
157
+ suffix == o.suffix &&
158
+ display_name == o.display_name
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(o)
164
+ self == o
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Fixnum] Hash code
169
+ def hash
170
+ [successful, validation_result_first_name, validation_result_last_name, title, first_name, middle_name, last_name, nick_name, suffix, display_name].hash
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+ self.class.swagger_types.each_pair do |key, type|
179
+ if type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
183
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
184
+ end
185
+ elsif !attributes[self.class.attribute_map[key]].nil?
186
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
187
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
188
+ end
189
+
190
+ self
191
+ end
192
+
193
+ # Deserializes the data based on type
194
+ # @param string type Data type
195
+ # @param string value Value to be deserialized
196
+ # @return [Object] Deserialized data
197
+ def _deserialize(type, value)
198
+ case type.to_sym
199
+ when :DateTime
200
+ DateTime.parse(value)
201
+ when :Date
202
+ Date.parse(value)
203
+ when :String
204
+ value.to_s
205
+ when :Integer
206
+ value.to_i
207
+ when :Float
208
+ value.to_f
209
+ when :BOOLEAN
210
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
211
+ true
212
+ else
213
+ false
214
+ end
215
+ when :Object
216
+ # generic object (usually a Hash), return directly
217
+ value
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else # model
230
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
231
+ temp_model.build_from_hash(value)
232
+ end
233
+ end
234
+
235
+ # Returns the string representation of the object
236
+ # @return [String] String presentation of the object
237
+ def to_s
238
+ to_hash.to_s
239
+ end
240
+
241
+ # to_body is an alias to to_hash (backward compatibility)
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_body
244
+ to_hash
245
+ end
246
+
247
+ # Returns the object in the form of hash
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_hash
250
+ hash = {}
251
+ self.class.attribute_map.each_pair do |attr, param|
252
+ value = self.send(attr)
253
+ next if value.nil?
254
+ hash[param] = _to_hash(value)
255
+ end
256
+ hash
257
+ end
258
+
259
+ # Outputs non-array value in the form of hash
260
+ # For object, use to_hash. Otherwise, just return the value
261
+ # @param [Object] value Any valid value
262
+ # @return [Hash] Returns the value in the form of hash
263
+ def _to_hash(value)
264
+ if value.is_a?(Array)
265
+ value.compact.map{ |v| _to_hash(v) }
266
+ elsif value.is_a?(Hash)
267
+ {}.tap do |hash|
268
+ value.each { |k, v| hash[k] = _to_hash(v) }
269
+ end
270
+ elsif value.respond_to? :to_hash
271
+ value.to_hash
272
+ else
273
+ value
274
+ end
275
+ end
276
+
277
+ end
278
+
279
+ end
@@ -0,0 +1,199 @@
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: unset
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveValidateApiClient
16
+ # Request to get the gender from a first name
17
+ class GetGenderRequest
18
+ # Input first name (given name) to get the gender of
19
+ attr_accessor :first_name
20
+
21
+ # Optional; the country for this name, possible values are \"US\", \"LY\", \"NI\", \"TT\", \"MK\", \"KZ\", \"BO\", \"UG\", \"TZ\", \"CL\", \"SI\", \"MA\", \"RW\", \"VN\", \"AW\", \"CY\", \"BH\", \"SG\", \"ZA\", \"MU\", \"BR\", \"TN\", \"KH\", \"US\", \"TH\", \"TW\", \"UY\", \"DO\", \"CO\", \"UA\", \"QA\", \"BY\", \"SN\", \"SD\", \"FJ\", \"LB\", \"BE\", \"ML\", \"LV\", \"FR\", \"TM\", \"NG\", \"EC\", \"NO\", \"SL\", \"CR\", \"PA\", \"GE\", \"CH\", \"KR\", \"RS\", \"ZM\", \"FI\", \"BF\", \"MC\", \"AU\", \"GA\", \"LS\", \"RU\", \"IN\", \"SE\", \"LK\", \"BZ\", \"MX\", \"GH\", \"AF\", \"TJ\", \"BN\", \"DZ\", \"CM\", \"GR\", \"MD\", \"HN\", \"AT\", \"NZ\", \"SV\", \"GW\", \"NA\", \"AR\", \"MZ\", \"PK\", \"MN\", \"IQ\", \"BW\", \"VE\", \"PT\", \"BS\", \"AL\", \"TG\", \"ID\", \"ET\", \"CF\", \"JP\", \"BB\", \"PH\", \"CU\", \"BD\", \"AO\", \"SM\", \"LC\", \"ME\", \"RO\", DANIL\"O\"\", \"ES\", \"EE\", \"IL\", \"ZW\", \"SY\", \"MW\", \"LU\", \"IR\", \"SC\", \"NL\", \"JO\", \"AM\", \"DE\", \"GL\", \"OM\", \"DK\", \"HR\", \"LI\", \"TD\", \"KM\", \"BA\", \"GM\", \"GD\", \"CA\", \"CZ\", \"MR\", \"ST\", \"IS\", \"LR\", \"IE\", \"VC\", \"AE\", \"KG\", \"DJ\", \"TR\", \"KE\", \"NE\", \"UZ\", \"CN\", \"GQ\", \"SK\", \"BJ\", \"MG\", \"BT\", \"EG\", \"PL\", \"IT\", \"SA\", \"MY\", \"CI\", \"AG\", \"AD\", \"KS\", \"HU\", \"CG\", \"KP\", \"DM\", \"GN\", \"GT\", \"NP\", \"JM\", \"LA\", \"GB\", \"BG\", \"HT\", \"PE\", \"AZ\", \"LT\", \"SZ\", \"PY\", \"MT\", \"VA\"
22
+ attr_accessor :country_code
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'first_name' => :'FirstName',
29
+ :'country_code' => :'CountryCode'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'first_name' => :'String',
37
+ :'country_code' => :'String'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
+
49
+ if attributes.has_key?(:'FirstName')
50
+ self.first_name = attributes[:'FirstName']
51
+ end
52
+
53
+ if attributes.has_key?(:'CountryCode')
54
+ self.country_code = attributes[:'CountryCode']
55
+ end
56
+
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ return invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ return true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ first_name == o.first_name &&
78
+ country_code == o.country_code
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(o)
84
+ self == o
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Fixnum] Hash code
89
+ def hash
90
+ [first_name, country_code].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def build_from_hash(attributes)
97
+ return nil unless attributes.is_a?(Hash)
98
+ self.class.swagger_types.each_pair do |key, type|
99
+ if type =~ /\AArray<(.*)>/i
100
+ # check to ensure the input is an array given that the the attribute
101
+ # is documented as an array but the input is not
102
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
103
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
104
+ end
105
+ elsif !attributes[self.class.attribute_map[key]].nil?
106
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
107
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
108
+ end
109
+
110
+ self
111
+ end
112
+
113
+ # Deserializes the data based on type
114
+ # @param string type Data type
115
+ # @param string value Value to be deserialized
116
+ # @return [Object] Deserialized data
117
+ def _deserialize(type, value)
118
+ case type.to_sym
119
+ when :DateTime
120
+ DateTime.parse(value)
121
+ when :Date
122
+ Date.parse(value)
123
+ when :String
124
+ value.to_s
125
+ when :Integer
126
+ value.to_i
127
+ when :Float
128
+ value.to_f
129
+ when :BOOLEAN
130
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
131
+ true
132
+ else
133
+ false
134
+ end
135
+ when :Object
136
+ # generic object (usually a Hash), return directly
137
+ value
138
+ when /\AArray<(?<inner_type>.+)>\z/
139
+ inner_type = Regexp.last_match[:inner_type]
140
+ value.map { |v| _deserialize(inner_type, v) }
141
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
142
+ k_type = Regexp.last_match[:k_type]
143
+ v_type = Regexp.last_match[:v_type]
144
+ {}.tap do |hash|
145
+ value.each do |k, v|
146
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
147
+ end
148
+ end
149
+ else # model
150
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
151
+ temp_model.build_from_hash(value)
152
+ end
153
+ end
154
+
155
+ # Returns the string representation of the object
156
+ # @return [String] String presentation of the object
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # to_body is an alias to to_hash (backward compatibility)
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_body
164
+ to_hash
165
+ end
166
+
167
+ # Returns the object in the form of hash
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_hash
170
+ hash = {}
171
+ self.class.attribute_map.each_pair do |attr, param|
172
+ value = self.send(attr)
173
+ next if value.nil?
174
+ hash[param] = _to_hash(value)
175
+ end
176
+ hash
177
+ end
178
+
179
+ # Outputs non-array value in the form of hash
180
+ # For object, use to_hash. Otherwise, just return the value
181
+ # @param [Object] value Any valid value
182
+ # @return [Hash] Returns the value in the form of hash
183
+ def _to_hash(value)
184
+ if value.is_a?(Array)
185
+ value.compact.map{ |v| _to_hash(v) }
186
+ elsif value.is_a?(Hash)
187
+ {}.tap do |hash|
188
+ value.each { |k, v| hash[k] = _to_hash(v) }
189
+ end
190
+ elsif value.respond_to? :to_hash
191
+ value.to_hash
192
+ else
193
+ value
194
+ end
195
+ end
196
+
197
+ end
198
+
199
+ end